Glam Prestige Journal

Bright entertainment trends with youth appeal.

I need some help.I try to write csh script and I need to iterate through all files in current dir and do some tasks, so I wrote this:

#!/bin/csh
foreach f ($(ls)) if( some condtions) echo "$f"
end

but every time I try to run this, I get: Illegal name error.

1 Answer

This seems to not be the whole script. The if( some condtions) won't run because some condtions is being interpreted as an unknown value, and not true or false.

Csh seems to be unfavorable by many, and I personally recommend bash.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy