Re: Bash: pipe once more
Stefan Schmidt wrote:
> I want to change the working directory and if there is an error (e.g. the directory doesn't exist) I want that to be logged to a file and printed on stdout. With the above command that doesn't work since the working directory is the same as before execution of the command.
>
if [ \! -d some_path ] ; then
echo There was an error
echo There was an error >> log.txt
# There must be an intelligent way to combine the above two lines, but
I'm not in the mood to discover it right now.
exit 1;
fi
cd some_path
Warning: The above may contain bashisms.
--
"One Architecture, One OS" also translates as "One Egg, One Basket".
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br
http://move.to/hpkb
Reply to: