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 8602271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:02:40+00:00 2026-06-12T02:02:40+00:00

This is an excerpt from the instructions of my homework for my operating systems

  • 0

This is an excerpt from the instructions of my homework for my operating systems class. The bolded portion is the part I cannot make sense of, nor can I reach the professor right now and I’d really like to start this tonight. I know what an environment variable is, I suppose…just a variable declared in the shell, right? But what does the bolded line in particular mean?

Write a C program to implement an interactive shell in which users execute commands.

Call this program myshell (so use gcc -o myshell -Wall etc. to
compile).

Create an infinite loop that repeatedly prompts the user to enter a
command (see example output and input below).

Before executing the command entered by the user, the command must be
found using the path specified by environment variable THEPATH (do not
use PATH!).
By default, the THEPATH variable is not set, so for
testing, you’ll want to set (and unset) this variable manually (see
details below). If THEPATH is found, your program must execute the
command in a child process via fork() and one of the exec() system
calls.

To obtain and parse THEPATH, consider using the getenv() function and
the strtok() or strsep() functions.

  • 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-12T02:02:41+00:00Added an answer on June 12, 2026 at 2:02 am

    For a shell to run a program, it has to know where that program is. For example, you want to be able to type ls at the prompt, but the actual binary for ls might be found at /bin/ls. That’s where PATH (or your case, THEPATH) comes in. When you type ls, the shell goes off and looks in each PATH directory for a program with a matching name. When it finds one, it runs it. Let’s use ls as an example, and a PATH set to:

    /usr/local/bin:/usr/bin:/bin
    

    Assuming ls is /bin/ls, then the shell first looks for ls in /usr/local/bin, doesn’t find it, then looks in /usr/bin, and then finally finds it in /bin and executes it.

    Actually doing this operation is where the hint in your assignment about getenv, strtok, and strsep comes in.

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

Sidebar

Related Questions

Greetings! I must be seeing things. Look at this excerpt from the iPhone OS
I have this HTML structure (excerpt): <td> <select id=test1 class=pub_chooser> <option value=99>All Publications</option> <option
I'm reading up on developing GWT apps and read an excerpt from this page:
This is an excerpt from a source file of wxPython: Create the output window
This is an excerpt from AnyEvent::Intro # register a read watcher my $read_watcher; $read_watcher
Here's an excerpt from java.text.CharacterIterator documentation: This interface defines a protocol for bidirectional iteration
I've created a custom cell class using these instructions: http://www.bdunagan.com/2009/06/28/custom-uitableviewcell-from-a-xib-in-interface-builder/ Everything worked great, except
Can someone explain what this excerpt from Single Page Apps in Depth means? A
This is an excerpt from my code: <div id=column2> <div id=textbox> <h3>About</h3> <div id=text>
I finished homework for a graduate course in operating systems. I got a great

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.