On Thu, Feb 01, 2001 at 05:40:30PM -0800, Hidong Kim <[EMAIL PROTECTED]>
wrote:
| I have the following bash script called push:
|
| #!/bin/bash
|
| pushd ()
| {
| dirname=$1
| DIR_STACK="$dirname ${DIR_STACK:-$PWD' '}"
| cd ${dirname:?"missing directory name."}
| echo "$DIR_STACK"
| }
|
|
| If I source this script, and do 'pushd /etc', I get what I expect. I
| also have this script called pushdir:
|
| #!/bin/bash
|
| pushd ()
| {
| dirname=$1
| DIR_STACK="$dirname ${DIR_STACK:-$PWD}"
| cd ${dirname:?"missing directory name."}
| echo "$DIR_STACK"
| }
|
| pushd $1
|
|
| If I do 'pushdir /etc', it echoes $DIR_STACK, but it doesn't cd to
| /etc. What's wrong here? I'm running bash 1.14.7(1). Thanks,
It does do the cd. In the shell which runs the script. Which is _not_
your main shell, but a child. The parent does not move. The child
exits, having done your cd.
--
Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/
There's two kinds of climbers...smart ones, and dead ones. - Don Whillans
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list