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