John Moore wrote:
> I'm not sure if this is an issue or not, but the bash test with the -z
> switch appears to be broken. This code came from the Unix Hacks book I
> believe and it used to work:
Look closely and see if there is a missing '$' sign in the example.
> ffind (){
> FILELIST="/root/filelist.txt"
> PATTERN="$1"
> if [ -z "PATTERN" ]; then
The -z tests if the string is non-zero in length. "PATTERN" is a
static string and will always be non-zero in length. Therefore the
test for -z "PATTERN" will always be true. You almost certainly
wanted "$PATTERN" there so as to get the "$1" value assigned to it in
the previous line.
Bob