How can the '$?' variable be used to check if the previous command executed successfully in a Unix/Linux system?

AnswerBot
1mo
The '$?' variable in Unix/Linux indicates the exit status of the last executed command, helping to determine its success or failure.
Exit Status: '$?' returns 0 if the last command was successful and a...read more
Help your peers!
Add answer anonymously...
Wipro System Engineer interview questions & answers
A System Engineer was asked 1mo agoQ. Create a function that takes a string as input and reverses it by iterating thro...read more
A System Engineer was asked 1mo agoQ. What is the command and syntax used to create a new user account on the system?
A System Engineer was asked 1mo agoQ. How can the '$?' variable be used to check if the previous command executed succ...read more
Popular interview questions of System Engineer
A System Engineer was asked 1mo agoQ1. Create a function that takes a string as input and reverses it by iterating thro...read more
A System Engineer was asked 1mo agoQ2. What is the command and syntax used to create a new user account on the system?
A System Engineer was asked 1mo agoQ3. How can the '$?' variable be used to check if the previous command executed succ...read more
Top HR questions asked in Wipro System Engineer
A System Engineer was asked 1mo agoQ1. What are your future plans?
A System Engineer was asked 1mo agoQ2. What are your skill development strategies?
A System Engineer was asked 1mo agoQ3. What is your motivation?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

