Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Unix Script ignoring cmd line vars
Name: bluesman73 Date: April 27, 2004 at 12:13:28 Pacific OS: aix CPU/Ram: pseries server 2 gb ram
Comment:
I'm getting a little frustrated and would appreciate any help.
I'm writting a unix script, and no matter what I do, it ignores the command line variables. At this point, I'm just trying to echo out what the value is to prove that it is coming in.
Name: Wolfbone Date: April 27, 2004 at 12:59:12 Pacific
Reply:
Could it be you need the #!/bin/some_shell line at the top?
0
Response Number 2
Name: bluesman73 Date: April 27, 2004 at 13:59:35 Pacific
Reply:
Well, I'm a noob, but I added in the line indicating what shell i'm using #!/bin/ksh
it didn't work at first. I then started typing fast and furious, trying different combinations of, basically: /bin/ksh ./run_it 1 2
and it didn't work at first..but then suddenly it did work. The only problem is, I didn't pay attention to what I was typing and closed the window. So I've another newbie question:
If you were to invoke this script in the korn shell, how would you do it?
0
Response Number 3
Name: Wolfbone Date: April 27, 2004 at 14:52:51 Pacific
Reply:
Just as you have done!
1) write the script, putting magic string in the first line
2) $> chmod +x script_file
3) $> ./script_file arg1 arg2 ... argn
I can't see what could be wrong. The only other thing I can think of is that some OSes don't recognise #!/bin/ksh - they need a space: #! /bin/ksh. You could look for some scripts in the systemwide /bins that take arguments and see if they are working properly.
0
Response Number 4
Name: Wolfbone Date: April 27, 2004 at 14:58:35 Pacific
Reply:
Just had another thought - try print instead of echo.
0
Response Number 5
Name: bluesman73 Date: April 28, 2004 at 06:56:52 Pacific
Reply:
Thanks for the help.
Neither made any different. I think something quarky is going on. I'm going to skip this issue and move on.
Summary: Can someone help me decipher this? This is from an older Unix script, not sure exactly what it does: ... find . $DATA -newer $DATESTAMP -exec stat -m {} \; > $FILELIST ... $DATA is a list of files in ...
Summary: Basically in unix script I would like to know what the command is ot get the cursor (telling you what line you are on) back to the top - without closing the file and re-opening thanks Chris ...
Summary: Hi there, Is there any professional here help me on this? I'm totally new with UNIX env. Also, I got the first assignment regarding UNIX Script. I don't know where to start... well, the instruction sa...