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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.