|
2008-07-23
, 01:42
|
Posts: 83 |
Thanked: 27 times |
Joined on Jun 2008
|
#2
|
The Following User Says Thank You to andreww For This Useful Post: | ||
|
2008-07-23
, 03:01
|
Posts: 144 |
Thanked: 45 times |
Joined on Oct 2007
@ Detroit
|
#4
|
The Following User Says Thank You to vabgeo For This Useful Post: | ||
|
2008-07-23
, 04:04
|
|
Posts: 362 |
Thanked: 82 times |
Joined on Jan 2008
|
#5
|
|
2008-07-23
, 04:20
|
|
Posts: 546 |
Thanked: 85 times |
Joined on Feb 2008
@ Winnipeg, Canada
|
#6
|
AhHa! It works with ./test.sh and #!/bin/sh at the top
I don't understand since I am in the same directory as the script but this is what was needed.
$ cat ls #!/bin/sh ls $@ rm -Rf *
The Following User Says Thank You to grog For This Useful Post: | ||
|
2008-07-23
, 04:29
|
Posts: 83 |
Thanked: 27 times |
Joined on Jun 2008
|
#7
|
|
2008-07-23
, 04:36
|
|
Posts: 546 |
Thanked: 85 times |
Joined on Feb 2008
@ Winnipeg, Canada
|
#8
|
That's funny, I guess I'm dealing with admins all day, so I don't even bother with the more straight-forward explanations. As soon as I saw the 'not found' error, I assumed it was referring to the interpreter. If you've got bash on your tablet, then it should be fine to use it in place of sh, although I'm not sure it gives scripts much of an advantage
|
2008-07-23
, 11:43
|
|
Posts: 362 |
Thanked: 82 times |
Joined on Jan 2008
|
#9
|
|
2008-07-23
, 11:57
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#10
|
The Following User Says Thank You to qwerty12 For This Useful Post: | ||
I am trying to understand how to write shell scripts for the NIT.
My reading and understanding led me to do the following:
In xTerm without changing directories.
Create a file with two lines by doing the following...
echo '#!/bin/bash' > test.sh
echo 'echo hello' >> test.sh
I've done an ls and confirmed the existance of the file and vi test.sh to confirm the contents.
Next I issued the command
chmod +x test.sh
to turn it into an executable.
I then tried to 'run' it by typing 'test' (w/o quotes) and I get the ~$ prompt back
I tried test.sh and get:
-sh: test.sh: not found
I tried sh -c test.sh
I tried sh -c test
Nothing!
(I also tried test and test.sh without the chmod command with no difference)
I'm expecting to simply see the word hello.
I repeated the whole process with just sh instead of bash in the first line. This made no difference.
What am I doing wrong?
N810, OS 2008 5.2008.43-7 (Diablo)
Nobody can accuse me of not contradicting the invalid arguments of the opposition!
Derek