foreach syntax error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting foreach syntax error
# 1  
Old 10-10-2003
foreach syntax error

I wrote a simplistic script which works fine in my HP Korn environment using for in do done but when I converted it for csh it is balking at my syntax specifically the parens for the argument. Any help would be appreciated




set -x
cut -f1 -d, bryan > sim
cut -f2 -d, bryan > imsi
set ki=`cut -f3 -d, bryan`
cut -f4 -d, bryan > cyph
cut -f5 -d, bryan > ans1
cut -f6 -d, bryan > ans2
cut -f7 -d, bryan > ans3
foreach i ($ki)
./des_cryp -k $i -d 1234567891234567 >>ekiout
end
paste -d, sim imsi ekiout cyph ans1 ans2 ans3 > final


error:

./scr: syntax error at line 9: `(' unexpected
# 2  
Old 10-10-2003
additional info

I used the exact syntax with the sam system variables in command line and it work perfectly. At a lost, I know it is something stupid I am missing. Once again Thanks for your assistance
# 3  
Old 10-10-2003
You need a line
#! /usr/bin/csh
as your first line in the script. Do you have that?
# 4  
Old 10-12-2003
I knew I forgot something, Thanks for the help
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

2. Linux

Ambiguous redirect error and syntax error when using on multiple files

Hi, I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help ); #!/bin/bash #... (16 Replies)
Discussion started by: Madhusudan Das
16 Replies

3. Shell Programming and Scripting

Foreach statement error in cshell

Hi, while executing the following c-shell script i got the error "Couldn't find an 'end' to close a 'foreach' statement" can't find the mistake ...plz help.. script :: echo "enter build folder name in following sequence L-<REV>_<BUILD>" set BUILD = $< set file= `cat file1` foreach i... (2 Replies)
Discussion started by: arup1980
2 Replies

4. Shell Programming and Scripting

Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected.

Hi All I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error. #!/bin/ksh #------------------------------------------------------------------------- # File: ang_stdnld.ksh # # Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies

5. Shell Programming and Scripting

for / foreach syntax issues (in bash or tcsh)

So I am new to unix, and actually anything outside drag and drop with the mouse (been learning for about a week so far) . I have been using the foreach command in tcsh because I am working on a group of files. Basically what I need is to insert part of the filename as the first line in the file.... (0 Replies)
Discussion started by: thepolypore
0 Replies

6. Shell Programming and Scripting

Foreach loop. Error : Too many words from ``

Hi expert, I have a large text file :- number.txt 1 2 3 4 5 6 .... And i using csh foreach loop to read the file line by line. foreach line(`cat number.txt) set number = $line <Calculation> end (2 Replies)
Discussion started by: vincyoxy
2 Replies

7. Shell Programming and Scripting

C Shell - foreach - No Match error

Hi All, I am facing 'No Match' problem with foreach loop in C shell script. Initially I tried following grep command showing results properly as shown at the end of the Thread. But foreach command is throwing the error 'No match'. grep -n Inserted audit_file foreach insertstr (`grep -n... (0 Replies)
Discussion started by: adurga
0 Replies

8. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

9. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies
Login or Register to Ask a Question