bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should this be this way?


From: Linda Walsh
Subject: Re: Should this be this way?
Date: Thu, 28 Feb 2013 20:52:07 -0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666


Chet Ramey wrote:
> On 2/27/13 11:05 PM, Linda Walsh wrote:
>>
>> Greg Wooledge wrote:
>>>> How often, when at a terminal, do you type #!/bin/bash before every line?
>>> When I've put the contents into a file?  Every. single. time.
>> ---
>> Then when I press 'v' to edit the command line in a text editor --
>> maybe 'bash' should insert such a line?  It's converted your command line
>> into an editable file.  But it hasn't put the #!/bin/bash at the front.
> 
> This is a bad example.  The file that is the result of the vi-mode `v'
> command is run as if it were sourced with `.'.  It's not run as if it
> were a shell script.
===========
It's not rocket science to think that you don't want to keep hopping
back and forth from the command line to a GUI editor, so a logical
progression would have many people saving the file into /tmp/xxx,
chmod +x /tmp/xxx; gvim /tmp/xxx ; ... and continue...

People are used to side-by-side development looking at source and running
in another window, so as soon as people start opening a cmd line in
an external editor, it's quite rational to assume that some percentage
of them will save the file and continue work as a normal workflow.

It isn't one I use every day, but may scripts start out as 1 liners that
grow and are saved into files.

If I save the script in a 'bin' directory, I add the header, but
if it's in /tmp, it's not the first thing I'm thinking about.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]