Article View: comp.unix.programmer
Article #3846Re: pushd for Korn shell
From: Ȳ����
Date: Thu, 02 Mar 2000 00:00
Date: Thu, 02 Mar 2000 00:00
27 lines
1489 bytes
1489 bytes
Z. Huang <zhuang@ic.sunysb.edu>��(��) �Ʒ� ������
news:38BDC193.EDC5B857@ic.sunysb.edu�� �Խ��Ͽ����ϴ�.
> I'd like to write a script which perform the task done by pushd in
> C shell. My idea to use the environment variable to preserve the
> directories. The problem is the value of these environment variables
> cannot be preserved after exiting from the script. Could someone give me
> a hint or pointer? Thanks in advance.
>
Why don't you adopt a shell function rather than a script.
Here is an example of mine.
pushd(){
echo "$PWD" > ~/.pushd
}
popd(){
cd `cat ~/.pushd`
}
If you are using Born shell
pushd(){
pwd > $HOME/.pushd
}
popd(){
cd `cat $HOME/.pushd`
}
Technical Details
Message-ID:
<G4lv4.105$045.4352@news2.bora.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38BDC193.EDC5B857@ic.sunysb.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f9e87,4b884d75840695bf,start X-Google-Attributes: gidf9e87,public X-Google-Thread: fc89c,3d3a2b9b0fa790bb X-Google-Attributes: gidfc89c,public From: "Ȳ����" <boyhon@itplus.co.kr> Subject: Re: pushd for Korn shell Date: 2000/03/02 Message-ID: <G4lv4.105$045.4352@news2.bora.net> X-Deja-AN: 592061334 References: <38BDC193.EDC5B857@ic.sunysb.edu> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Trace: news2.bora.net 951967142 210.182.160.116 (Thu, 02 Mar 2000 12:19:02 KST) Organization: Dacom X-MSMail-Priority: Normal NNTP-Posting-Date: Thu, 02 Mar 2000 12:19:02 KST Newsgroups: comp.unix.programmer,han.comp.os.unix