I very new to C Shell. I am trying to read a file from the command line, and determine whether it's a zip file, a .txt, a symbloic link, a pipe, or whatever ("unknown").
Then I'd like to execute a few instructions depending on the type. For instance, if it's a txt file, print information about it ("it's a text file") and give its size.
Here is what I what got so far:
#!/bin/csh if ($#argv < 1) then echo "Usage: $0 file [...]" exit 1 endif foreach file ($*) set ft=`file $file | cut -d: -f 2` switch ("$ft") case "*Zip*": echo "$file is a zip file" breaksw case "*shell script*": echo "$file is a shell script" breaksw case "*ASCII*": echo "$file is ascii" breaksw case "*symbol*": echo "$file is a link" breaksw endsw end