From: Glynn Clements Subject: Re: Two questions Date: Sun, 11 Dec 2005 08:55:47 +0000 Message-ID: <17307.59795.987515.143323@cerise.gclements.plus.com> References: <439B707C.9070808@tuxdoit.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <439B707C.9070808@tuxdoit.com> Sender: linux-admin-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="us-ascii" To: MARG Cc: linux-admin@vger.kernel.org MARG wrote: > Following my previous question ("Subject: cutting"), how can i: > > 1) Detect if the file filname being stripped is missing in the > filesystem, and accordingly, abort the script with an error; if [ ! -f "$file" ] ; then echo "file '$file' not found" >&2 exit 1 fi > 2) How can i change directories inside a bash script ("cd" doesn't works). A process can only change its own working directory; you cannot change the working directory of another process. E.g. a script cannot change the working directory of its parent (the process from which the script was run). -- Glynn Clements