[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash: pipe once more



On 2008-07-13T15:21:21-0400, Allan Wind wrote:
> Finally, you could check for the error conditions before doing the cd:
> 
> if [ -d $dir -a -x $dir ];
> then
> 	echo cannot cd into $dir
> else
> 	cd $dir
> fi

Reverse the logic of course:

if [ -d $dir -a -x $dir ];
then
	cd $dir
else
 	echo cannot cd into $dir
fi


/Allan


Reply to: