175k views
0 votes
Which command is used to debug a shell script program?

1) set
2) set -x
3) debug
4) Cannot be determined

1 Answer

4 votes

Final answer:

The command to debug a shell script is 'set -x', which enables a trace of commands and their arguments during execution, essential for troubleshooting.

Step-by-step explanation:

The command used to debug a shell script program is set -x. When you add set -x at the beginning of a script, it provides a trace of commands and their arguments as they are executed. This is useful for seeing what is happening within a script at the command level, which can be invaluable for troubleshooting issues.

To enable debugging temporarily within a script, you can use 'set -x' to start debugging and 'set +x' to stop it. This allows you to control which parts of your script are debugged without affecting the entire script's execution.

User NicE
by
7.4k points

Related questions