Re: Two questions

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

 



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 <glynn@xxxxxxxxxxxxxxxxxx>
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux