Need help
Hi I am newbie to Linux and I need to learn Linux programming .
I need to write a function and try to debug that fuction . How can I debug the function in Shell script . Please help me on this . |
Hi jyothinagendra, and welcome to LQ.
You need to give us more information on what you are trying to achieve. Which script are you trying to debug? Also, in future, I would suggest that you use a more helpful thread title. "Need help" is not very useful and tells people nothing about your issue before they open the thread. "Need help with debugging Shell script" would, for example, have been better. |
Quote:
The other debugging tool is echo. The Bash guide in my signature also has a debugging section that suggests more tools: https://mywiki.wooledge.org/BashGuid...ices#Debugging. In case you have a particular problem you need to solve, you can also describe it here, as hydrurga suggests. |
In addition to the above useful replies, especially set -x, I'd also point you to the ShellCheck web site.
If you're looking for online guides, I'd recommend these resources, among others: What have you gotten written so far and where are you stuck? If you post your script here for assistance, please remember to wrap it in [code] [/code] tags so that the indentation is retained. |
Welcome to LQ.
One of the links in my signature covers bash script debugging methods. Enjoy! |
For bash you run it with -x. Or debug it the hard way by adding echo's after every line to show location and values of interest. For other compiled languages you need to use gdb. Plus compile the program with debugging turned on.
|
Quote:
This link might help: http://tldp.org/LDP/Bash-Beginners-G...ect_02_03.html |
Personally I like 'set -xv' for a bit more info - YMMV :)
|
Code:
#!/bin/bash *sigh* books... Do kids even know what those are? At work we flip material "like a book" to print on the second side correctly. The blank stares I get when I explain, like a ????. |
Quote:
homework... Do the kids even do that anymore? Yes they do, they use Wat - t - pad hahaha |
All times are GMT -5. The time now is 12:14 PM. |