[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: trm - a command that removes files into a temporary "trash" folder
Well, I just wanted to give you a few shell-script programming tips:
The next and filename _compiled_ programs that are part of your solution are not necessary because you can do the same with standard UNIX commands.
The next program can be replaced by `expr $VERSION + 1` (the spaces are important!). Thus your line will now look like:
VERSION=`expr $VERSION + 1`
rather than
VERSION="`next $VERSION`"
And for the filename program it can be replaced like that:
FILE=`echo "$i" | sed 's/^.*\///'`
instead of
FILE=`filename $i` .
FYI, "expr" is a UNIX program that calculate the value math formulas, and is the standard way to do even the most basic mathematical operations in a shell command (but can also calculate sin(), cos() and various other functions, IINM). "sed" processes a text based on a regular expression and outputs the processed text. For more information, check the man pages.
Shlomi Fish