help-bash
[Top][All Lists]
Advanced

[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 16:37:30 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Apr 09, 2012 at 09:27:43AM EDT, Greg Wooledge wrote:
> 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).

Spot on..

I ran the script like so:

| $ (unset BASH_ENV; myscript)

.. and the directory is no longer echoed to the terminal.

The BASH_ENV variable points to this:

| if [ -d /etc/bash_functions ]; then
|       cd /etc/bash_functions
|       for i in $(ls); do
|               . $i
|       done
|       cd -
| fi
|       
| if [ -d /home/cj/.bash_functions ]; then
|       cd /home/cj/.bash_functions
|       for i in $(ls); do
|               . $i
|       done
|       cd -
| fi
|
| shopt -s expand_aliases
| 
| if [ -f /home/cj/.bash_aliases ]; then
|       . /home/cj/.bash_aliases 
| fi

Unsure about the implications but for now I changed the two ‘cd -’
commands to ‘cd - > /dev/null’ and the directory name is no longer
echoed to the terminal.

Thanks,

CJ

-- 
Hi! My name is bobby...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]