Use a grepped file as an included source in bash
- by Andrew
I'm on a shared webhost where I don't have permission to edit the global bash configuration file at /ect/bashrc. Unfortunately there is one line in the global file, mesg y, which puts the terminal in tty mode and makes scp and similar commands unavailable. My local ~./bashrc includes the global file as a source, like so:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
My current workaround uses grep to output the global file, sans offending line, into a local file and use that as a source.
# Source global definitions
if [ -f /etc/bashrc ]; then
grep -v mesg /etc/bashrc > ~/.bash_global
. ~/.bash_global
fi
Is there a way to do include a grepped file like this without the intermediate step of creating an actual file? Something like this?
. grep -v mesg /etc/bashrc > ~/.bash_global