LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-05-2013, 11:41 PM   #1
raj010
LQ Newbie
 
Registered: Aug 2009
Posts: 20

Rep: Reputation: 0
Red face 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.
 
Old 11-06-2013, 12:06 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
exec it as a single command: /bin/sh -c 'ls -l | grep "something"'
 
Old 11-06-2013, 12:54 AM   #3
raj010
LQ Newbie
 
Registered: Aug 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ygrex View Post
exec it as a single command: /bin/sh -c 'ls -l | grep "something"'
I'm trying to execute it without shell.
 
Old 11-06-2013, 01:38 AM   #4
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
then you need to implement | and && without shell
 
Old 11-06-2013, 03:27 AM   #5
raj010
LQ Newbie
 
Registered: Aug 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ygrex View Post
then you need to implement | and && without shell
Thanks for the reply.
I'll try to implement the same!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing multiple commands on multiple Linux machines earlfox Linux - General 13 07-13-2012 02:47 PM
[SOLVED] Problem in executing multiple commands through password less sudo vysakh@gmail.com Linux - Server 6 08-04-2009 08:11 AM
executing multiple commands by ssh jpan Linux - General 1 10-22-2004 03:12 PM
Executing Linux commands in C programs--->please help dennyvm Programming 3 01-15-2004 11:51 AM
python, executing regular linux commands Robert0380 Programming 3 06-26-2003 04:35 PM


All times are GMT -5. The time now is 08:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration