I have an executable bash file with commands.
It appears these files do not show what is being executed as the lines get executed by the terminal.
Is there a way to show the lines that are being executed?
I have an executable bash file with commands.
It appears these files do not show what is being executed as the lines get executed by the terminal.
Is there a way to show the lines that are being executed?
You would have to use bash's debugging option, bash -x HelloWorld.sh
or #!/bin/bash -x
This will produce the following output...
+ echo 'Hello, World!'
Hello, World!
See more here
Another option is to add set -x
to the script where you would like execution to begin debugging. You can also use set +x
to stop.
Example:
#!/bin/sh
set -x
echo "This will be debugged"
set +x
echo "This will not be debugged"