Moderator's Comments:
|
|
This thread has been moved from a non-technical forum to a technical forum.
|
|
You haven't told us what operating system or shell you're using and
gzgrep is not a "standard" utility that is available on all systems. (And, since it isn't present on the system I'm using, I have no idea what it is supposed to do.)
Running
ls with no operands will give you a list of all filenames in the directory in which you run your script as long as the first character of the filename in not a period.
It isn't obvious to me why you would want to execute
gzgrp in a command substitution instead of running it directly in your script. But no mater which way you invoke it, the redirection you're using will create the file that you then look for in the following
if statement.
If
gzgrep has options similar to the "standard"
grep utility, you might want to look at the
-q option and just check the exit status of
gzgrep to determine if it found a match or not instead of looking for a file that will always be present.
Alternatively, depending on the output produced by
gzgrep, you might want to look at the size of the file it produces instead of just looking to see whether or not the file exists.