No subject
Fri Jan 31 06:23:24 EST 2014
>From suter Mon Nov 26 16:11:07 2001
Return-Path: <majordom at caliburn.humbug.org.au>
Received: from diadora.client.uq.net.au (diadora-2 [10.0.1.2])
by zwitterion.humbug.org.au (8.12.1/8.12.1/Debian -2) with ESMTP id fAQ6B7NT028122
for <suter at zwitterion.humbug.org.au>; Mon, 26 Nov 2001 16:11:07 +1000
Received: from caliburn (mail at caliburn.humbug.org.au [203.15.51.6])
by diadora.client.uq.net.au (8.12.1/8.12.1/Debian -2) with ESMTP id fAQ6B605024269
for <suter at zwitterion.humbug.org.au>; Mon, 26 Nov 2001 16:11:06 +1000
Received: from majordom by caliburn with local (Exim 3.12 #1 (Debian))
id 168Efa-00075u-00
for <general-outgoing at lists.humbug.org.au>; Mon, 26 Nov 2001 15:51:06 +1000
Received: from mailin5.bigpond.com ([139.134.6.78])
by caliburn with esmtp (Exim 3.12 #1 (Debian))
id 168EfV-00075l-00
for <general at lists.humbug.org.au>; Mon, 26 Nov 2001 15:51:01 +1000
Received: from EUMUNDI.mat-man.com.au ([144.135.24.75]) by
mailin5.bigpond.com (Netscape Messaging Server 4.15) with SMTP
id GNE8JB00.1MI for <general at lists.humbug.org.au>; Mon, 26 Nov
2001 15:57:11 +1000
Received: from 203.52.73.112 ([203.52.73.112]) by bwmam03.mailsvc.email.bigpond.com(MailRouter V2.9k 8323/21082045); 26 Nov 2001 15:50:23
Message-Id: <4.3.2.7.2.20011126145301.00b1a0f8 at mail.bigpond.com>
X-Sender: easo.thankachen at mat-man.com.au@mail.bigpond.com
X-Mailer: QUALCOMM Windows Eudora Version 4.3.2
Date: Mon, 26 Nov 2001 15:39:33 +1000
To: general at lists.humbug.org.au
From: Easo Thankachen <easo.thankachen at mat-man.com.au>
Subject: Re: [H-GEN] change directory shell script reverting to orginal
directory
In-Reply-To: <Pine.OSF.4.30.0111261406580.8061-100000 at fox.uq.net.au>
References: <4.3.2.7.2.20011126130753.00b0d450 at mail.bigpond.com>
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="=====================_26370598==_.ALT"
Precedence: bulk
Reply-To: general at lists.humbug.org.au
X-Loop: general at lists.humbug.org.au
List-Help: <mailto:majordomo at lists.humbug.org.au?subject=help>
List-Post: <mailto:general at lists.humbug.org.au>
List-Subscribe: <mailto: general-request at lists.humbug.org.au?subject=subscribe>
List-Id: semi-serious discussions about Humbug and Unix-related topics <general at lists.humbug.org.au>
List-Unsubscribe: <mailto: general-request at lists.humbug.org.au?subject=unsubscribe>
List-Archive: <http://archive.humbug.org.au/humbug-general/>
Sender: Majordomo <majordom at caliburn.humbug.org.au>
Status: RO
Content-Length: 5317
Lines: 151
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]
--=====================_26370598==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
Thanks for that reply, Raymond
I had a feeling it was landing back in the parent shell.
The user i log into currently uses sh and the script is placed in
/usr/local/bin which is in the path
I tried taking of the #!/bin/sh , but that did not help. The solution you
suggested
seems to be shell specific.
Would there be some command/directive that will force the script to be
executed in the same shell.
Such a simple script probably should not be shell specific.
Thanks
Easo
At 02:12 PM 26/11/2001, you wrote:
>[ Humbug *General* list - semi-serious discussions about Humbug and ]
>[ Unix-related topics. Please observe the list's charter. ]
>[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]
>
>Hi ET,
>
>On Mon, 26 Nov 2001, Easo Thankachen wrote:
> > i have this script to change to a directory and display the directory
> > that it has changed to with some basic validations. But it display the
> > correct directory and then reverts back to the directory the command
> > was called.
>
>This can be a little confusing when you are getting started. The answer
>is:
>
> >#!/bin/sh
>
>starts a whole new command shell. When you change directory within the
>script, you are doing so within this shell and not the parent shell
>that executed the command.
>
>If instead you ran your script as (under bash):
>
>$ source cwd directory
>
>then the script would be executed by the current shell and the directory
>would be changed as you would expect. This is obviously a bit inconvenient
>but you could add an alias to do it (again in bash):
>
>$ alias cwd='source ~/bin/cwd $1'
>
>or you could write out the command here (being careful to quote newlines).
>
>Cheers,
>
>Raymond
>---
>raymond at humbug.org.au Just once, I'd like to quote someone famous in
> my .sig and spell their name right -- Mi.
>
>
>--
>* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
>* Postings to this list are only accepted from subscribed addresses of
>* lists 'general' or 'general-post'.
--=====================_26370598==_.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<font size=3>Thanks for that reply, Raymond<br>
<br>
I had a feeling it was landing back in the parent shell.<br>
The user i log into currently uses sh and the script is placed in
/usr/local/bin which is in the path<br>
<br>
I tried taking of the #!/bin/sh , but that did not help. The solution you
suggested <br>
seems to be shell specific.<br>
<br>
Would there be some command/directive that will force the script to be
executed in the same shell. <br>
Such a simple script probably should not be shell specific.<br>
<br>
Thanks<br>
Easo<br>
<br>
At 02:12 PM 26/11/2001, you wrote:<br>
<blockquote type=cite cite>[ Humbug *General* list - semi-serious
discussions about Humbug and ]<br>
[ Unix-related topics. Please observe the list's
charter.
]<br>
[ Worthwhile understanding:
<a href="http://www.humbug.org.au/netiquette.html" eudora="autourl">http://www.humbug.org.au/netiquette.html</a>
]<br>
<br>
Hi ET,<br>
<br>
On Mon, 26 Nov 2001, Easo Thankachen wrote:<br>
> i have this script to change to a directory and display the directory<br>
> that it has changed to with some basic validations. But it display the<br>
> correct directory and then reverts back to the directory the command<br>
> was called.<br>
<br>
This can be a little confusing when you are getting started. The answer<br>
is:<br>
<br>
>#!/bin/sh<br>
<br>
starts a whole new command shell. When you change directory within the<br>
script, you are doing so within this shell and not the parent shell<br>
that executed the command.<br>
<br>
If instead you ran your script as (under bash):<br>
<br>
$ source cwd directory<br>
<br>
then the script would be executed by the current shell and the directory<br>
would be changed as you would expect. This is obviously a bit inconvenient<br>
but you could add an alias to do it (again in bash):<br>
<br>
$ alias cwd='source ~/bin/cwd $1'<br>
<br>
or you could write out the command here (being careful to quote newlines).<br>
<br>
Cheers,<br>
<br>
Raymond<br>
---<br>
raymond at humbug.org.au Just once, I'd like to quote someone famous in<br>
<x-tab> </x-tab><x-tab> </x-tab><x-tab> </x-tab>my .sig and spell their name right -- Mi.<br>
<br>
<br>
--<br>
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .<br>
* Postings to this list are only accepted from subscribed addresses of<br>
* lists 'general' or 'general-post'. </font></blockquote></html>
--=====================_26370598==_.ALT--
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list