Displaying Shell ExpansionWhen a command is entered in the command line, it expands into its output which is displayed. This is called expansion. The command you're typing will be printed with the help of echo command on the terminal. This command will be useful when you want to check what your command is doing in the shell.
set -xThe 'set -x' command enables shell command display. Syntax: Example: Look at the above snapshot, 'set -x' displays shell expansion in the terminal. You can see what the shell is doing with the given command. With command "echo $USER" shell expansion shows that $USER is converted to 'sssit'. With command "echo \$USER" shell expansion shows that due to special character backslash (\) $USER is not converted to 'sssit'. set +xThe 'set +x' command disables shell command display. Syntax: Example: Look at the above snapshot, shell expansion is disabled and hence, output is directly printed in the terminal.
Next TopicLinux Control Operators
|