Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6054351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:08:35+00:00 2026-05-23T08:08:35+00:00

Possible Duplicate: Running a shell command in a c program I am running a

  • 0

Possible Duplicate:
Running a shell command in a c program

I am running a shell script from C.It is executed using system().How to pass parameters to this script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:08:36+00:00Added an answer on May 23, 2026 at 8:08 am

    system takes a single string containing the entire command line, so you’d pass

    system("/your/shell/script 'argument 1' 'argument 2'");
    

    It is rarely a good idea to use system, because you’ll have to escape all meta-characters yourself – even spaces are a problem, as you can see above. You’re looking for one of the exec* functions, for example execv. Its first argument is the name of the program (in your case /bin/sh or the shell script itself), its second is a NULL-terminated list of argument strings:

    char* program = "/your/shell/script";
    char* args[3];
    args[0] = "argument 1";
    args[1] = "argument 2";
    args[2] = NULL;
    execv(program, args);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: Quick-and-dirty way to ensure only one instance of a shell script is
Possible Duplicate: Asynchronous shell exec in PHP i need to run a java program
Possible Duplicate: Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: Singleton: How should it be used Following on from Ewan Makepeace 's
Possible Duplicate: Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on
Possible Duplicate: Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on
Possible Duplicate: Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on
Possible Duplicate: How can I hide the console window in a PyQt app running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.