foreach? for one line in tcsh
I've seen few examples about the foreach in tcsh, all of them
are broken to a script and over more lines. I wanted to execute the stuff as a handy one liner but I get as an output foreach? so what gives? As a shell script this works: Code:
#!/bin/tcsh Code:
foreach x ( 1 2 3 );echo $x;end |
You can't put foreach and the end keywords on one line. This is clearly stated from the man page:
Quote:
|
Quote:
dont know much about 'tcsh' but you can try something like this; may or may not work did'nt tested it: Code:
alias command '(echo "for x (1 2 3)"; echo "$x"; echo "end";)'|tcsh |
well easier to settle for writing the short script then - funny though
|
All times are GMT -5. The time now is 09:08 PM. |