小编gle*_*man的帖子

bash shell 错误:“没有这样的文件或目录”

我正在尝试在 Ubuntu 14.04 上安装Virtualenv包装器。但是每当我启动终端时,我都会收到错误提示 bash:

/usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh:没有这样的文件或目录。

我还通过使用检查了 bashrc 脚本gedit ~/.bashrc,但没有这样的行。有谁知道我错在哪里?

bash virtualenv

17
推荐指数
4
解决办法
2万
查看次数

是否有一个相当于 bash `help` 内置函数的 zsh ?

在 bash 中,我可以使用该help命令打印特定内置命令的概要

$ help pwd
pwd: pwd [-LP]
    Print the name of the current working directory.

    Options:
      -L    print the value of $PWD if it names the current working
            directory
      -P    print the physical directory, without any symbolic links

    By default, `pwd' behaves as if `-L' were specified.

    Exit Status:
    Returns 0 unless an invalid option is given or the current directory
    cannot be read.
Run Code Online (Sandbox Code Playgroud)

zsh 中是否有等效项,或者我只是使用man zshbuiltins

zsh

16
推荐指数
1
解决办法
1万
查看次数

在 xargs 中执行子命令

我想将文件夹 A 的所有二进制文件软链接到文件夹 B,例如,

find /home/A/bin/* -print | xargs -I {} ln -sf {} /tmp/B/$(basename {})
Run Code Online (Sandbox Code Playgroud)

问题是我无法在 xargs 中执行子命令。

我该怎么办 ?

unix shell

8
推荐指数
3
解决办法
4765
查看次数

将 Outlook 2003 规则导出为文本

我遇到了 Outlook 2003 的规则大小限制,所以我想合并/删除我的规则。我希望能够看到所有这些,而不是一次编辑一个。Outlook 规则的导出格式是一些二进制“*.rwz”文件。

有没有办法将 Outlook 规则导出到文本或 Excel 文件中?

export microsoft-outlook-2003

6
推荐指数
1
解决办法
8304
查看次数

在 find/grep 搜索结果中保留换行符

我正在使用以下脚本递归搜索从其他文件调用的 php 脚本的出现。

find . -exec grep -Hn $1 {} \; | grep -v ^Binary;
Run Code Online (Sandbox Code Playgroud)

效果很好!现在,我需要返回的结果来确定下一步要采取的行动。

r=$(find . -exec grep -Hn $str {} \; | grep -v ^Binary;)

 if [ -z "$r" ];
    then
          Do this
    else
          Do something else
    fi
Run Code Online (Sandbox Code Playgroud)

问题: find 脚本通过它自己返回结果,每个结果都在一个新行上。

./path/to/file.php
./path/to/another_file.php
./path/to/third_file.php
Run Code Online (Sandbox Code Playgroud)

但是,将输出分配给 $r 变量时,不会保留换行符,结果打印在一行上,因此难以阅读。

./path/to/file.php ./path/to/file.php ./path/to/third_file.php
Run Code Online (Sandbox Code Playgroud)

如何在将输出分配给变量时保留换行符?

bash grep find newlines

5
推荐指数
1
解决办法
8018
查看次数

Linux shell:如何向 stderr 消息添加前缀字符串?

我在后台同时运行多个任务。

command_a | tee > command_a.log &
command_b | tee > command_b.log &
Run Code Online (Sandbox Code Playgroud)

如果一切正常,则消息将保存到日志文件中。

如果出现问题,它会在屏幕上打印错误。

但是command_a 和command_b 非常相似,很难分辨哪个错误信息是由哪个命令产生的。

我可以在错误消息中添加前缀字符串,例如:

command_a: error 123
command_b: error 456
command_a: error 256
command_a: error 555
command_b: error 333
Run Code Online (Sandbox Code Playgroud)

shell stderr

3
推荐指数
1
解决办法
2942
查看次数

标签 统计

bash ×2

shell ×2

export ×1

find ×1

grep ×1

microsoft-outlook-2003 ×1

newlines ×1

stderr ×1

unix ×1

virtualenv ×1

zsh ×1