[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: |
Tue, 10 Apr 2012 08:04:15 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Mon, Apr 09, 2012 at 04:37:30PM -0400, Chris Jones wrote:
> 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
In addition to what Bob and Eric said, this could be better written:
if [ -d /etc/bash_functions ]; then
for i in /etc/bash_functions/*; do
. "$i"
done
fi
That would avoid the issue with unwanted "cd -" output, and also avoid
issues caused by filenames with spaces in them, on which $(ls) will break
quite badly.
- Re: [Help-bash] Current working directory echoed to the terminal, (continued)
- Re: [Help-bash] Current working directory echoed to the terminal, Bob Proulx, 2012/04/10
- 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 <=