Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It's as simple as adding this line to the beginning of your file:
Code:
set -x
Regards,
Alunduil
Do you mean this command can enable shell script to run step-by-step (like the step-next feature of an IDE, for example, F6 in Eclipse in debug mode)? I have tried and it only prints out the commands (including output of command) contained in the script file and a sign '+' before each command.
I have tried both methods you mentioned. Do you mean this command can enable shell script to run step-by-step (like the step-next feature of an IDE, for example, F6 in Eclipse in debug mode)? I have tried and it only prints out the commands (including output of command) contained in the script file and a sign '+' before each command.
alienDog,
I have tried both methods you mentioned. Do you mean this command can enable shell script to run step-by-step (like the step-next feature of an IDE, for example, F6 in Eclipse in debug mode)? I have tried and it only prints out the commands (including output of command) contained in the script file and a sign '+' before each command.
regards,
George
Yes, printing them is what it does. I don't think it's possible to run commands "step by step" with bash, but I'll look into it and get back to you.
Yep. It not possible with default bash. What I'd suggest is placing a 'read' command to the points where you want the execution to pause. This way the execution stops at that point until you hit enter. You could also consider echoing something appropriate to screen at the certain points of the screen.
Code:
command1
command2
...
echo "Debug message #1 [hit enter to continue]"
read
command3
command3
...
echo "Debug message #2 [hit enter to continue]"
read
It will ease finding errors, though it's not the same as being able to execute the scripts step by step. More help on debugging here:
Yep. It not possible with default bash. What I'd suggest is placing a 'read' command to the points where you want the execution to pause. This way the execution stops at that point until you hit enter. You could also consider echoing something appropriate to screen at the certain points of the screen.
Code:
command1
command2
...
echo "Debug message #1 [hit enter to continue]"
read
command3
command3
...
echo "Debug message #2 [hit enter to continue]"
read
It will ease finding errors, though it's not the same as being able to execute the scripts step by step. More help on debugging here:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.