On 05/05/2011 09:17 PM, website reader wrote:
> (2) if test -e `ls m* | head -1` ; then echo "found"; fi

Michael's solution does work, and you can put it all on a single line:

FILE_THERE=`ls m* 2>/dev/null | head -1` ; [ -e $FILE_THERE ] && echo 
"found"

If it finds one then it reports and exits.

Of course, it also reports success for directories and recursively. This 
might be better:

FILE_THERE=`find m* -maxdepth 0 2>/dev/null | head -1` ; [ -e 
$FILE_THERE ] && echo "found"

Larry
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to