[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suppressing pushd output



The Wanderer wrote:
> Bob Proulx wrote:
> > If you don't need CDPATH then try unsetting it.
> 
> Is CDPATH used at all by pushd / popd? I don't see any indication of
> that in bash(1), but since cd itself isn't involved here AFAICT,
> bringing up CDPATH wouldn't seem to make sense otherwise.

Well we are both right.  It is used.  But unsetting it won't quiet
down pushd and popd since pushd already emits a line regardless.

  rwp@havoc:~$ CDPATH=/usr/local
  rwp@havoc:~$ cd sbin
  /usr/local/sbin
  rwp@havoc:/usr/local/sbin$ cd

Regular cd using it.

  rwp@havoc:~$ pushd sbin
  /usr/local/sbin
  /usr/local/sbin ~
  rwp@havoc:/usr/local/sbin$ popd
  ~

Regular pushd uses it.

  rwp@havoc:~$ unset CDPATH
  rwp@havoc:~$ cd sbin
  -bash: cd: sbin: No such file or directory
  rwp@havoc:~$ cd /usr/local/sbin
  rwp@havoc:/usr/local/sbin$ cd

Regular cd is normal without it.

  rwp@havoc:~$ pushd /usr/local/sbin
  /usr/local/sbin ~
  rwp@havoc:/usr/local/sbin$ popd
  ~
  rwp@havoc:~$ 

But pushd produces output regardless of CDPATH.  Making my comment
unlikely to be the actual problem seen with pushd.

So basically CDPATH causes cd to emit the path *and* it causes pushd
to emit the path found from CDPATH too.  But that is an additional
line on top of the regular pushd output too.

Oh well.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: