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

Re: how to grep error messages



On Sun, Jun 28, 2009 at 11:42:58AM +0200, Michelle Konzack wrote:

> But I would prefer something like:
> 
>     if [ $(cd "$1") -ne 0 ]
>         then echo "badbadbad" ; exit 1
>     fi

Note that this runs the 'cd' command in a subdirectory, and thus it has
no effect on the parent process.

And then again, you could have simply used:

      if !cd "$1"; then
        echo "badbadbad"
        exit 1
      fi

-- 
Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
ICQ# 16849754         |                    | friend


Reply to: