質問

I need to execute the following grep query as an argument for konsole (the kde terminal)

grep -R -i -n -A 2 -B 2 --color=always -R "searchtext" * | less -R

works for the current terminal.

konsole --workdir `pwd` -e grep -R -i -n -A 2 -B 2 --color=always -R "searchtext" * | less -R

works, but the konsole window displays the grep query without less pipe.

Ideally I want konsole to spawn as seperate process with konsole &

and send the grep command with less as an argument for konsole -e

役に立ちましたか?

解決

You need to run the pipe in a shell.

konsole --workdir pwd -e bash -c 'grep -R -i -n -A 2 -B 2 --color=always -R "searchtext" * | less -R'
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top