>Hi, I have a very simple C shell script that does not do what I expect:
>It is in a file called test.
It's not a good idea to call your program "test", as this is a built-in in
most shells.
Also, before you get into bad habits, you should learn to script in a
better language than C shell. It's OK as an interactive shell, but a poor
scripting language.
Quote:>when I enter--
>$ test 1 2 3 enough ... ... ... also tried ./test 1 2 3 enough
>I get: bad number argv.
>Can anyone please help with what is going wrong?
>thanking you in advance.
> #!/bin/csh -f
> set x = $argv[1]; shift argv
The argument to "shift" must be a number -- it's the number of places to
shift. You can't specify which variable to shift, it always operates on
argv.
> foreach y ( $argv[*] )
> set z = $x
> while ( $z )
> echo -n "$y, "
> end
> echo \!
> end
--
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.