On Thu, 5 May 2011, Michael Rasmussen wrote:
The ls stands in for the -e test:
FILE_THERE=`ls m* 2/dev/null | head -1`
if [ $FILE_THERE ];
then
echo found $FILE_THERE
fi
if test $(/bin/ls m* 2/dev/null | wc -l) -gt 0; then
echo found it...
fi
--
Paul Heinlein heinl...@madboa.com
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