I have this:
cd $dir
if[ $? -eq 0 ]; then ...
else echo "The directory doesn't exist"; exit -1;
fi
And what I want is that if the cd returns an error (on the 1st line) the error won’t be shown by the shell. I only want to be shown the message that I wrote.
I tried to do:
ret=$(cd $dir)
But that doesn’t work. How can I do it?
Redirect standard error: