You are not logged in.
sudo ifconfig eth0|grep "inet addr"|awk -F ' ' '{print $2}'|awk -F ':' '{print $2}' ---->> this command ok
but
konsole --new-tab --hold -e /bin/sh -c "echo "pwd" | sudo -S ifconfig eth0|grep "inet addr"|awk -F ' ' '{print $2}'|awk -F ':' '{print $2}'"
not run...
Offline
You need to escape all the double quotes inside the command string of the -c option:
-e /bin/sh -c "echo \"pwd\" ...
and the $ signs also: \$
Last edited by berbae (2014-06-18 09:36:18)
Offline
how ? for example ? i try but not runing
Offline
Give the exact command you run and the error message please.
In fact you need to escape the $ signs also.
Last edited by berbae (2014-06-18 09:37:09)
Offline
sudo ifconfig eth0|grep "inet addr"|awk -F ' ' '{print $2}'|awk -F ':' '{print $2}' --->>> result 10.6.5.25 my local ip OK...
but i need result on new console
konsole --new-tab --hold -e /bin/sh -c "echo "pwd" | sudo -S ifconfig eth0|grep "inet addr"|awk -F ' ' '{print $2}'|awk -F ':' '{print $2}'"
not run...
Last edited by darknesspider (2014-06-18 10:02:29)
Offline
You just repeat your first post without any changes in the konsole launch command: why?
I told you that you need to escape the double quotes and the dollar signs inside the command string of the -c option.
That will lead you to:
konsole --new-tab --hold -e /bin/sh -c "echo \"pwd\" | sudo -S ifconfig eth0|grep \"inet addr\"|awk -F ' ' '{print \$2}'|awk -F ':' '{print \$2}'"Your command could be simplified to just two pipes (maybe even one), I think; but with your writing you need escaping as I showed you.
Thinking about it, why do you need to run a konsole new tab just to show something? You have notification tools for that, like notify-send or others.
Last edited by berbae (2014-06-18 15:14:48)
Offline