[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: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Current working directory echoed to the terminal |
Date: |
Mon, 9 Apr 2012 09:27:43 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Mon, Apr 09, 2012 at 01:48:08AM -0400, Chris Jones wrote:
> I have recently upgraded to bash v4.1.5 (debian lenny to debian squeeze)
> and I noticed that every time I run a bash script that starts with
> ???#!/bin/bash???, the current directory is echoed to the terminal.
Sounds like you've set some sort of option or variable, either in the
environment, or in your ~/.bashrc (if you've also set BASH_ENV).
> Interestingly, I was able to work around the problem by replacing
> #!/bin/bash by #!/bin/sh. It is unclear why, since /bin/sh is a soft
> link to /bin/bash.
When invoked as sh, bash changes its behavior in many ways. One of
those ways is probably "ignore whatever option/variable the user set
that causes directories to be echoed".
I don't know a full list of all the various options/settings that can
cause directory names to be written. One that I do know off the top of
my head is CDPATH:
imadev:~$ export CDPATH=~
imadev:~$ cd /tmp
imadev:/tmp$ cd bin
/net/home/wooledg/bin
imadev:~/bin$
There may be others.