How do you debug a bash script
Hello,
Ok I've been typing in a bash script from a book and I successfully found some typos and got rid of them. Also, I got help earlier from here about for loops. So I've made progress but I'm stuck again. I suppose my question is how do you debug a bash script. I have Fedora Core 3 running on a legacy machine, so no GUI just command line only. At the moment all I know is how to use VI. What other tools are good? For example, is there a tool that I can use to print out lines 53-56 from a script. I remember tail from a course but that only did the lines at the end of a script. I have checked the listing against the book and I'm getting Code:
:command not found How can I make these go away? More importantly the later lines that instruct iptables are not being executed because iptables -L gives the default. I think that I have a problem similar to a missing close quote but I can see none. Do any of this make sense to you guys? Regards, Meadensi |
With vi you can type: 53G to go to line 53
|
If you either:
Code:
set -x Code:
bash -x scriptname |
Thanks,
Code:
bash -x scriptname Cheers, Meadensi |
Ok, so new problem
People,
Ok so now I have a new problem. When I run the code (using the bash -x option ) ... Code:
# Enable broadcast echo Protection Code:
+echo 1 The pathname is definitely valid. I do not know why this is happening? This is my first script, albeit out of a book so some configurations options may yet need changing. Any ideas? Meadensi |
All times are GMT -5. The time now is 02:30 PM. |