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

  • SEARCH
  • Home
  • 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 8866431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:46:56+00:00 2026-06-14T16:46:56+00:00

I have to execute a command whose path is unknown. I can reach the

  • 0

I have to execute a command whose path is unknown. I can reach the environment paths, but how can I use them? For example if there are 5 distinct paths, which one I should try in execv ?

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

After parsing these paths in an array, how can I use them? Should I try execv for each of them?

  • 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-06-14T16:46:58+00:00Added an answer on June 14, 2026 at 4:46 pm

    You could just use execvp, which searches for the binary in the executing shell’s PATH (see http://linux.about.com/library/cmd/blcmdl3_execv.htm).

    If that’s not an option, you should probably do the same as execvp / the shell does: Look at one path after another (left to right) and check if there’s an executable with the given name in there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have execute-extended-command bound to alt+a. So when in minibuffer, when i press it,
I have a powershell command running when I execute a bat file, The command
I want to execute multiple shell-commands with php's exec command. The commands have to
I have need to execute a command in a script an arbitrary number of
It's not the first time I have tried to execute a system command from
I have a command that I need to use repeatedly within a shell script.
I use a program (on Windows), whose name I won't disclose, that can be
I have a string command I'd like to execute asynchronously while writing to its
I have the following to execute shell commands using Node: function puts( error, stdout,
I have a question regarding the creation of a utility that executes another command.

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.