LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux - Executing multiple commands using execv (https://www.linuxquestions.org/questions/linux-newbie-8/linux-executing-multiple-commands-using-execv-4175483536/)

raj010 11-05-2013 10:41 PM

Linux - Executing multiple commands using execv
 
I'm using "execv" to execute Linux commands in my application. It's working fine in case of a single command. I'm wondering how could I use execv for executing multiple commands.

Following are the examples of my use case

/bin/ls -l | grep "something"
OR
/bin/ls -l && /bin/ls

Thanks in advance.

Ygrex 11-05-2013 11:06 PM

exec it as a single command: /bin/sh -c 'ls -l | grep "something"'

raj010 11-05-2013 11:54 PM

Quote:

Originally Posted by Ygrex (Post 5059067)
exec it as a single command: /bin/sh -c 'ls -l | grep "something"'

I'm trying to execute it without shell.

Ygrex 11-06-2013 12:38 AM

then you need to implement | and && without shell

raj010 11-06-2013 02:27 AM

Quote:

Originally Posted by Ygrex (Post 5059106)
then you need to implement | and && without shell

Thanks for the reply.
I'll try to implement the same!


All times are GMT -5. The time now is 06:14 PM.