Question
In C Programming: I think I have up to here: Each of the following tokens shall be expanded within each word: Any occurrence of ~/
In C Programming:
I think I have up to here:
Each of the following tokens shall be expanded within each word:
Any occurrence of "~/" at the beginning of a word shall be replaced with the value of the HOME environment variable. The "/" shall be retained. (see GETENV(3))
Any occurrence of "$$" within a word shall be replaced with the proccess ID of the smallsh process (see GETPID(3)).
Any occurrence of "$?" within a word shall be replaced with the exit status of the last foreground command (see waiting).
Any occurrence of "$!" within a word shall be replaced with the process ID of the most recent background process (see waiting).
Not sure what to do with:
If an expanded environment variable is unset, it shall be interpreted as an empty string (""). This includes the PS1 variable as described above.
The $? parameter shall default to 0 ("0").
The $! parameter shall default to an empty string ("") if no background process ID is available.
Expansion shall occur in the forward direction in a single pass, and expanded text shall not participate in further expansion token recognition (expansion is not recursive).
Parsing
The words are parsed syntactically into tokens in the following order. Tokens recognized in a previous step do not take part in further parsing.
The first occurrence of the word "#" and any additional words following it shall be ignored as a comment.
If the last word is "&", it shall indicate that the command is to be run in the background.
If the last word is immediately preceded by the word "<", it shall be interpreted as the filename operand of the input redirection operator.
If the last word is immediately preceded by the word ">", it shall be interpreted as the filename operand of the output redirection operator.
Steps 3 and 4 may occur in either order (output redirection may occur before input redirection).
All words not listed above shall be interpreted as regular words and form the command to be executed and its arguments. The tokens listed above shall not be included as command arguments.
A valid command line may be either:
[command] [arguments...] [> outfile] [< infile] [&] [# [comment...]]
[command] [arguments...] [< infile] [> outfile] [&] [# [comment...]]
If "<", ">", and "&" appear outside of the end-of-line context described above, they are treated as regular arguments:
$ echo test < > & test test < > & test
So far:
thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started