|I am stuck on testing for Optional parameters in a c-shell script.|
this what I have so far
if($1 == "") then
echo "This shell script compresses files with a specific extension"
echo "Call syntax: minimize <suffix_name> <zipprog> <Size>
echo "Example: minimize doc"
if ($2 == "") then
set $3 = `compress`
#if ($file =~ *.$1) then
if (-f $file && $file =~ *.$1) then
set size = (`wc -c $file`)
if ($size < $4 ) then
the second If statement is failing with a missing File name error. Not sure what I am Missing since the first if statement works correctly. If I comment out the 2nd if, the script will work as it should with all the parameters filled in.
the object is to supply a directory, a list of file types, and the script will compress the those files. the optional part is to let the script know the size of the files to compress and which compression program to use. it should default to compress,
minimize -s 500 -p gzip /etc/host txt