shell scripts in Ubuntu

Asked by allchin

HI,

trying to run a borne or c shell script but can get the system to accept and run it, have done chmod +x to the file but is comes up with the following message, the script is call fred

allchit@allchit-desktop:~$ ls -lF fred
-rwx--x--x 1 allchit allchit 29 2008-01-13 20:30 fred*
allchit@allchit-desktop:~$ fred
bash: fred: command not found
allchit@allchit-desktop:~$

the file fred contains the following, basically just trying to get it to work

#!/bin/sh
echo "Hello World"

any ideas please,

regards, Trevor

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Vojtěch Trefný
Solved:
Last query:
Last reply:
Revision history for this message
Best Vojtěch Trefný (vojtech.trefny) said :
#1

Try this:
$ ./fred

Revision history for this message
Vojtěch Trefný (vojtech.trefny) said :
#2

PS:
Of course you must be in folder where is script fred located. If you want to run it with "fred" you must copy it to /usr/local/bin or use alias.

Revision history for this message
allchin (piperthree) said :
#3

Thanks Vojtěch Trefný, that solved my question.

Revision history for this message
allchin (piperthree) said :
#4

thats great, thanks for your help, I'll write my script now,

best wishes, Trevor