If the command "Set-X" is added to the script file, each command executed after the set command and any parameters added to the command line (including the values of variables and variables) will be displayed. A plus sign (+) is added before each line, prompting that it is the identifier of the trace output. The shell trace Command executed in the sub-shell will add two plus signs ("++ ".
For example:
#! /Bin/sh
Set-x
Echo-n "can you write device drivers? "
Read answer
Answer = 'echo $ answer | tr [A-Z] [A-Z]'
If [$ answer = 'y']
Then
Echo "Wow, you must be very skilled"
Else
Echo "neither can I, I'm just an example shell script"
Fi
Use the xtrace (-x) option to check whether the code runs as expected. If you just want to see the code of the running script file, the shell redundancy option-V is very useful. The syntax for closing and opening options is the opposite. You can use the minus sign of-X to open an option, or use the plus sign, for example, + X to close an option.
Note: spaces are not allowed to assign values. For example, answer = 'echo $ answer | tr [A-Z] [A-Z]'