Re: Using cd in scripts


Subject: Re: Using cd in scripts
From: Ed Jaeger (ed.jaeger@bgcorp.com)
Date: Thu Jun 15 2000 - 10:09:31 MDT


Running a shell script creates a new shell to run the scripts -
environment changes in the child are not passed back to the parent. Use
aliases (man bash) - they will be a lot faster as well!

John Kebbel wrote:
>
> In my DOS days, I was able to jump all over with one-line DOS batch
> files to my PERL directory or my JAVA directory. I tried the same thing
> with Linux but with no luck.
>
> For example, from the command line
>
> cd /mnt/macAux
>
> will take me to a Macintosh drive accessible from Linux. When I try and
> put this line in a script, however, Linux/bash (or PERL) evaluates the
> line, but it's a round trip. I go to that directory (I've added extra
> lines that create files that prove I've been there), but I'm back where
> I started as soon as the file finishes executing. This would be a really
> handy tool: I could jump to my HTML, cgi-bin, Mac disk, floppy disk,
> etc. with just a few characters.
> I've tried PERL variations with eval and do, but with no luck. I've
> also tried using chdir in place of cd.
> Is there anybody using this technique who can tell me what I'm doing wrong?

-- 
Ed Jaeger, CFO, Bohlender Graebener Corporation
ed.jaeger@bgcorp.com
http://www.bgcorp.com
---
"Live out of your imagination, not your history."

-- Stephen Covey



This archive was generated by hypermail 2a24 : Thu Jun 15 2000 - 10:11:50 MDT