Re: Shell scripting
> I have a script that performs batch zipping of files. Trouble is that it
> only does one file at a time (kind of going against the "batch" idea).
> Could someone point out the silly mistake I am obviously making?
> # batch zip
> # invoke with batchzip <filespec>
> # this will zip all files in the current directory that conform
> # to the file spec.
> if [ -n "$1" ]
> if [ -x "$ZIP" ]
> for file in "$1"
That's the problem: you ignore all arguments but the first. Try changing
this line to
> echo "Adding $file to $filename.zip..."
> $ZIP $ARGS "$filename" "$file" > /dev/null
> let "nofiles += 1"
> echo "finished ... processed $nofiles files."
> echo "Could not find 'zip'. Please check the path."
> echo "Usage : `basename $0` <filespec>"
> exit $retval
$ ((RANDOM%6)) || rm -rf ~