Command not found
David C. Curtis
dave.c.curtis at gmail.com
Sun Mar 4 02:31:23 UTC 2012
On 12-03-03 05:03 PM, Jonathan Hudson wrote:
> On Sat, 03 Mar 2012 21:34:54 +0000, John Sampson wrote:
>
>> Hello -
>>
>> I am new to Ubuntu, being a Windows user. I am accustomed to
>> running batch files by typing their names in a shell. When I try
>> this in Ubuntu 11.10 there is a 'command not found' error.
>> I found that the file has to be in a folder in the path for it to be
>> runnable from a shell. I attended to this by copying the file to
>> '/usr/bin' and also navigated to '/usr/bin' before tryng to run it.
>> I typed 'ls<filename>' to ensure that the file was present.
>> I tried prefixing with 'sudo' and checked the spelling of the file
>> name. Does it have to have a special suffix or anything? I cannot
>> think of any other solution to this. Any advice will be welcome.
>>
>> Also is there a brief basic account of the differences between
>> Ubuntu and Windows for reluctant users like myself who only
>> use Ubuntu because the program they want to use won't run
>> in Windows?
>>
>> Regards
>>
>> _John Sampson_
>>
>
> Scripts need to (a) be executable unless you provide the name of the
> interpreter, (b) either on the PATH or have an absolute or relative
> path provided and (c) unless you provide the name of the interpreter,
> have a #! line at the start.
>
> e.g.
>
> $ ./myscript
>
> $ ./myscript.sh
>
> $ sh myscript
>
> where myscript is executable (chmod +x myscript) and contains a #!
>
> #!/bin/bash
> echo "My script
>
> In general, you should not place non-system scripts in a system
> directory (/usr/bin) or do "user" stuff as root.
Throw all your scripts into the same directory and add that to your path
environment variable.
Don't add your home directory or any working dir to the path where the
contents constantly change or files you're not in complete control of
exist, where you uncompress files etc.
Adding dir to path:
http://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path
More information about the ubuntu-users
mailing list