[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash stating it is in a directory which does not exist
From: |
Chet Ramey |
Subject: |
Re: Bash stating it is in a directory which does not exist |
Date: |
Tue, 19 Feb 2013 11:52:38 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
On 2/19/13 10:09 AM, Chris Down wrote:
>> Bash can be improved by making it check for changes on each return.
If you think this is true, use the existing mechanisms to test your
hypothesis.
PROMPT_COMMAND='cd $PWD || cd ${PWD%/*}'
will do much of what you say you want. You can modify that to fit your
needs: redirect stderr to /dev/null, use cd -P, make it into a shell
function that loops until cd succeeds, add something to print the new
current directory if the second cd succeeds, and so on.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/