Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating script error messages

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, just a quick newbie question,

I'm writing a script which takes a filename as a parameter and I'm writing the error messages such as -

if [ -d $file ] then echo "$file is a directory"

but how do I create one that is returned when there is a particular character or string in the name of the file ?

many thanks
 
if [ -d $file ];then
if echo $file | grep <string>
then echo &quot;$file is a directory&quot;
fi
fi

&quot;Long live king Moshiach !&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top