Link to home
Start Free TrialLog in
Avatar of tomerps
tomerps

asked on

Unix ls --- No such file or directory

I need to capture the condition when jversion returns No such file or directory... ..


jversion=`ls -1td /sbcimp/run/tp/sun/jre/*-64bit* | head -1 | cut -d'/' -f7 | sed 's/v//' | tr -s " " | sed 's/^[ ]//g'`
 
if [????] 
else
fi

Open in new window

Avatar of ozo
ozo
Flag of United States of America image

is No such file or directory returned in $jversion? or is $jversion blank when ls -1td /sbcimp/run/tp/sun/jre/*-64bit*  prints No such file or directory on stderr?
Avatar of tomerps
tomerps

ASKER

Hi ozo, thanks for asking...it is done now. i captured the condition with followig code

if [ "$jversion"  = "No match" ] || [ "$jversion" = "0" ] || [ "$jversion" = "" ]
then
....


ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think ozo answered and should be rewarded to some degree.
agreed
Avatar of tomerps

ASKER

n/a
Do as you like.  I was not involved until the end - on points and fairness only.  I think ozo's answer is perectly valid and shows how the pipes work; beyond that he/she deserves some credit.