Re: Debugguing shel scripts
Worik Stanton <[email protected]>
| Newsgroups | gmane.org.user-groups.linux.dunedin.general |
|---|---|
| Message-ID | <[email protected]> |
On 05/07/13 11:17, Christopher Lee wrote: > Hi Worik, > > I'm not sure about a debugger but I've found putting `set -x` at the top of > my scripts helps me with debugging. > This will print to screen what each line of the script is doing, for > example: > > The script: > #!/bin/bash > > set -x > Yes. I use that and it is very useful. It solved my particular problem. But in principle shell programming (for me) is very broken without access to some sort of useful debugger. I rely heavily on them. I really wish that all shell scripts were Perl scripts...... cheers W > false > blah=This is something: $(uptime) > echo $blah > > results in: > $ ./test_script.sh > + false > ++ uptime > + blah='This is something: 11:16:17 up 1:53, 4 users, load average: > 0.39, 0.30, 0.33' > + echo This is something: 11:16:17 up 1:53, 4 users, load average: 0.39, > 0.30, 0.33 > This is something: 11:16:17 up 1:53, 4 users, load average: 0.39, 0.30, 0.33 > > > Hope this may be of some help, > Chris > > > On Fri, Jul 5, 2013 at 10:56 AM, Worik Stanton <[email protected]>wrote: > >> I have a misbehaving shell script. >> >> Are there any debuggers I can use that will let me step through a shell >> script? >> >> cheers >> W >> -- >> "As I went walking I saw a sign there And on the sign it said 'No >> Trespassing' But on the other side it didn't say nothing, That side >> was made for you and me" – Woody >> [email protected] 021-1680650, (03) 4821804 >> >> >> _______________________________________________ >> DunLUG mailing list >> [email protected] >> http://lists.ethernal.org/listinfo/dunlug >> DunLUG Wiki - http://dunlug.kallisti.net.nz/ >> > -- "As I went walking I saw a sign there And on the sign it said 'No Trespassing' But on the other side it didn't say nothing, That side was made for you and me" – Woody [email protected] 021-1680650, (03) 4821804 _______________________________________________ DunLUG mailing list [email protected] http://lists.ethernal.org/listinfo/dunlug DunLUG Wiki - http://dunlug.kallisti.net.nz/
signature.asc
(application/pgp-signature, 555 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJR1goDAAoJELNm0FBhV4ugNjsH/iH/TnFP0P8NWdSKb4EhQgyx XFAw9FdzVDMzloK/3ExGe7enBb62ko2W6Tp8vtZseFfwtFwTW0ujciqM9om9oRS5 dzvdAIiGqjnMWxYj7QwsZxN+dlrLED4xmaFWSPIGK+K5+mRrAmZZ4tIm7TlC4qN6 XAVxcDyEVcn9LWUbq+KmiRJcmCfQd0s6VpRpKl8hUuDGgfZ2L83DHPh/YzyiWLxh rIP9kN0lmPm+8lgYP2duW1xYx5LKlmdLYlIo8ngAMCS0kbvpviLks42OSh89ggCT osqDIlXrVea3BT5cam/G3Tg5ldrYl3YCoWEu2u8VCfiL0aybwzsb0+VNDQQszpc= =++57 -----END PGP SIGNATURE-----