【发布时间】:2011-01-28 00:02:39
【问题描述】:
我在一个共享的虚拟主机上,我没有在/ect/bashrc 编辑全局 bash 配置文件的权限。不幸的是,全局文件中有一行 mesg y,它将终端置于 tty 模式,并使 scp 和类似的命令不可用。我的本地 ~./bashrc 包含全局文件作为源,如下所示:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
我当前的解决方法是使用grep 将全局文件(无违规行)输出到本地文件中,并使用 that 作为源。
# Source global definitions
if [ -f /etc/bashrc ]; then
grep -v mesg /etc/bashrc > ~/.bash_global
. ~/.bash_global
fi
有没有办法在没有创建实际文件的中间步骤的情况下包含这样的 grepped 文件?像这样?
. grep -v mesg /etc/bashrc > ~/.bash_global
【问题讨论】:
-
为什么不在 ~/.bashrc 中使用
mesg n?在任何情况下,您都可以指定文件到 grep 或重定向 grep 的标准输入;不要无用地使用猫。 -
'Grokked' 不是 'grep' 的过去式。 google.com/search?q=define:grok
-
更改为 grepped...
mesg n似乎仍然强制终端进入某种类型的 tty 会话