10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Just started shell scripting for the first time today :D Can anyone tell me why I get the error "foreach: Words not parenthesized." for my following code? The program takes in a list of arguments.
foreach card ($argv)
end (3 Replies)
Discussion started by: pkuebler
2. UNIX for Dummies Questions & Answers
Hi everyone I'm new to unix and encountered a small problem i couldnt find out a reason why it doesn't work..please help..
in my csh script when i tried to use the foreach loop like this:
foreach x ( ls )
when i tried to run it, it printed out 'ls' to the std out instead of... (3 Replies)
Discussion started by: ymc1g11
3. UNIX for Dummies Questions & Answers
I'm working on a foreach loop to compare a couple sets of data. However, each datafile includes a header row. I'm wondering if it is possible to tell the foreach loop to skip the first line of data.
I've been using the basic code as follows:
foreach line ("`file.csv`")
set... (2 Replies)
Discussion started by: meteorologistks
4. Shell Programming and Scripting
I know cshell is harmful:) but I am using this just "to know" - for educational purposes!... not for a long-term use.
lets say i have a list..
set arr=(x y z e f)
I wanna iterate the list with foreach ,, not with while.!!
foreach i $arr
does not work (2 Replies)
Discussion started by: eawedat
5. Shell Programming and Scripting
I have a foreach loop in a csh script and I noticed that it tries to find the files with the pattern *$searchpt* in the file name. I'm confused as I never specified checking for the files.
foreach f ( *$searchpt* )
set fnew = `echo $f | awk -v searchpat=$searchpt \
... (1 Reply)
Discussion started by: kristinu
6. Shell Programming and Scripting
So I am back again beating my head against the wall with a shell script and getting a headache! I want to change each year in a file (1980, 1981, 1982, 1983, etc.) to the same year followed by a tab.
The input is "blah blah (1980) blah blah".
I want to get "blah blah (1980 ) blah blah".... (2 Replies)
Discussion started by: Peggy White
7. UNIX for Advanced & Expert Users
Is there any problem with the below 'foreach' loop?
foreach risk_factor ($(cat "$rf_list"))
where "rf_list=$SCRIPT/Utility/rflist.txt "
I'm wondering, it is throwing below error message:
syntax error at line 34: `(' unexpected
Any idea/suggestions ?
Thanks in advance /... (7 Replies)
Discussion started by: ganapati
8. Shell Programming and Scripting
Does anyone know what is wrong with this script. i keep getting errors
foreach filename (`cat testing1`)
set depth=`echo "$string"
the error is the following
testing: line 1: syntax error near unexpected token `('
testing: line 1:... (3 Replies)
Discussion started by: ROOZ
9. Shell Programming and Scripting
I have a loop which uses a wildcard
i.e. foreach f (*)
but when I execute the tcsh file in unix then it gives me an error
->>>>>>>foreach: words not parenthesized<<<<<<<<<<-
Any help. (1 Reply)
Discussion started by: abch624
10. Shell Programming and Scripting
What am I doing wrong with this foreach loop?
foreach var ($argv)
@sum = $sum + $var (4 Replies)
Discussion started by: haze21