[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Current working directory echoed to the terminal
From: |
Chris Jones |
Subject: |
Re: [Help-bash] Current working directory echoed to the terminal |
Date: |
Mon, 09 Apr 2012 23:48:53 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Mon, Apr 09, 2012 at 07:33:10PM EDT, Eric Blake wrote:
> On 04/09/2012 05:07 PM, Bob Proulx wrote:
[..]
> Careful, there's several issues here.
>
> POSIX requires cd to give output in the following two situations:
>
> If 'cd -' is used (regardless of CDPATH)
> if 'cd $dir' is successfully resolved due to CDPATH being set
>
> For the former, avoiding CDPATH has no effect. But if you don't like
> 'cd - > /dev/null' for fear that it silences too much, you can rewrite
> it as 'cd $OLDPWD' with no loss in generality and no output.
I kinda like this approach better on principle. What do you have in mind
when you state ‘silences too much’? Could cd try to write something else
to stdout?
> For the latter, unsetting CDPATH will indeed shut up cd, but that will
> also happen if you ensure that CDPATH is not consulted (by anchoring
> $dir - that is, if $dir starts with /, ./, or ../, it is anchored, and
> CDPATH will not be consulted). So it is always possible to write a
> script that works without cd output regardless of whether CDPATH is set.
>
> Finally, setting CDPATH in an interactive shell is highly useful.
> Exporting CDPATH to scripts is highly dangerous. Therefore, I recommend
> that you NEVER export CDPATH; feel free to set it for your own
> interactive use, but do not export it.
A bit over my head, but in any event, I don't use CDPATH.. as I see it,
it would just be another piece of data that I'd have to maintain.
Completion, together with readline's Alt+. and occasionally ‘-’ (OLDPWD)
more than meet my cd'ing needs.
CJ
--
WHAT YOU SAY??
- [Help-bash] Current working directory echoed to the terminal, Chris Jones, 2012/04/09
- Re: [Help-bash] Current working directory echoed to the terminal, Greg Wooledge, 2012/04/09
- Re: [Help-bash] Current working directory echoed to the terminal, Chris Jones, 2012/04/10
- Re: [Help-bash] Current working directory echoed to the terminal, Bob Proulx, 2012/04/11
- Re: [Help-bash] Current working directory echoed to the terminal, Chris Jones, 2012/04/15
- Re: [Help-bash] Current working directory echoed to the terminal, Bob Proulx, 2012/04/15
- Re: [Help-bash] Current working directory echoed to the terminal, Chris Jones, 2012/04/16
- Re: [Help-bash] Current working directory echoed to the terminal, Greg Wooledge, 2012/04/16
- Re: [Help-bash] Current working directory echoed to the terminal, Chris Jones, 2012/04/16
- Re: [Help-bash] Current working directory echoed to the terminal, Greg Wooledge, 2012/04/10