[PLUG] question for correct bash syntax for the test -e file command

Paul Heinlein heinlein at madboa.com
Fri May 6 15:25:47 UTC 2011


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 <> heinlein at madboa.com <> http://www.madboa.com/



More information about the PLUG mailing list