8

想在我的服务器上搜索特定文件并直接在 nano 中编辑它。

我试过这样,但它不会工作

find -name file.php | xargs nano $1

找到了文件,但它不会那样工作

Received SIGHUP or SIGTERM

怎么做?

4

2 回答 2

8

如果必须使用其他命令,另一种解决方案是使用反引号。例如,它对以下内容很有用git status

nano `git status | grep modified | awk '{ print $2 }'`

或者,使用查找:

nano $(find -name file\*.php)
于 2015-11-20T13:45:07.853 回答
2

我找到了使用查找实习生执行功能的解决方案

# find -name file.php -exec nano {} \;
于 2014-10-10T12:18:18.230 回答