8

was want to search for a specific file on my server and directly edit it within nano.

i tried it like this, but it wont work

find -name file.php | xargs nano $1

the file is found, but it wont work like that

Received SIGHUP or SIGTERM

how to do that proberly?

easteregg
  • 509
  • 4
  • 9

2 Answers2

8

Another solution is to use backticks if you have to use other command. It's for example useful with git status:

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

Or, with find:

nano $(find -name file\*.php)
sanmai
  • 29,083
  • 12
  • 64
  • 76
Rafał Wrzeszcz
  • 1,996
  • 4
  • 23
  • 45
2

i found the solution in using find intern exec function

# find -name file.php -exec nano {} \;
easteregg
  • 509
  • 4
  • 9