PDA

View Full Version : Variable problem



cborrero2000
10-28-2003, 07:29 AM
I did a script for Red Hat Linux 8 and it worked perfect then I restarted my computer with KNOPPIX and I tried to run the script and is giving me the following problems: :(

1) The script doesn't work if I dont add to the first line -xv or just -.
Like that #!/bin/csh doesn't work :?
Like that #!/bin/csh -vx works, and just with the dash (-) it works too. #!/bin/csh - :shock:

Why is happened that? What can i do?

2) When the program get to execute an intruction with the variable $#, it says that this variable doesn't exist.

Should i use another variable to know if there's a parameter passed with the command line?
Thank you for the answers :P

Dave_Bechtel
10-28-2003, 07:38 PM
--Just so you know, most ppl on this board are probably using bash. (Unforch I don't know the answer to your question - but it does work now, right?)

--I looked in the man page for csh, and the variable for arguments passed to the script is " $* ", same as bash. What is "$#" supposed to be? If you're looking for the number of words in a variable, it would be $#varhere.


I did a script for Red Hat Linux 8 and it worked perfect then I restarted my computer with KNOPPIX and I tried to run the script and is giving me the following problems: :(

1) The script doesn't work if I dont add to the first line -xv or just -.
Like that #!/bin/csh doesn't work :?
Like that #!/bin/csh -vx works, and just with the dash (-) it works too. #!/bin/csh - :shock:

Why is happened that? What can i do?

2) When the program get to execute an intruction with the variable $#, it says that this variable doesn't exist.

Should i use another variable to know if there's a parameter passed with the command line?
Thank you for the answers :P