Reputation: 24755
For this csh
script
#!/bin/csh
foreach file in (.)
echo "$file"
end
I get this error
foreach: Words not parenthesized.
How can I fix that?
Upvotes: 3
Views: 15498
Reputation: 5716
I found that csh was giving me issues splitting the files into their own iteration of $file
(it would lump all the files into a single string with EOL's in between! Go figure...), so I had to use the following explicit call to ls
:
foreach file ( `ls /path/to/directory/` )
echo "/path/to/directory/$file"
end
Upvotes: 0
Reputation: 242038
There should be no in
:
foreach file ( . )
Be sure to read Stop Using (and Teaching) C-Shell.
Upvotes: 6