[SunHELP] grep and show full path

Zsentient zsentient at anosc-e.5sigcmd.army.mil
Tue Jun 24 07:32:14 CDT 2003


Hello,

Hoping someone might be able to refresh my memory.  I have the following in a script:
grep -n $2 `pwd`"/"*
 
This works perfectly as long as there are more than one file in the directory where the grep is being executed.  But, if there is only one file in the directory the full path to the file is not displayed.  

I am aware that I could do a find from a parent directory and get the full path, but I would like to avoid doing a find due to the uneccessary files that would be searched, besides the files in the directory that the grep command is being executed.

Thanks, and hopefully not too trival as too make me feel completely mindless..



More information about the SunHELP mailing list