Discussion
Which of the following commands would return process_id of sleep command ?
Answer: D
The command that returns the process id of a background sleep command is "Sleep 1 and echo $!" (the shell variable $! holds the process id of the most recently started background command). The ampersand, which the printed text spells as "and", puts sleep in the background.
The variable $? gives the exit status of the last command, $# gives the number of positional parameters, and the printed $ with a multiplication sign is not the process id variable. Only $! gives the id of the background process.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development