LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 10: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-05-2013, 11:06 PM   #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-05-2013, 11:54 PM   #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, 12: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, 02: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



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 01:47 PM
[SOLVED] Problem in executing multiple commands through password less sudo vysakh@gmail.com Linux - Server 6 08-04-2009 07:11 AM
executing multiple commands by ssh jpan Linux - General 1 10-22-2004 02:12 PM
Executing Linux commands in C programs--->please help dennyvm Programming 3 01-15-2004 10:51 AM
python, executing regular linux commands Robert0380 Programming 3 06-26-2003 03:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:38 AM.

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
Open Source Consulting | Domain Registration