• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sh file write and debug

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Unix OS, using Putty to connect Unix server and trying to write sh file and run the sh file.when i run the file,i got many error on it,so wants to debug the sh file, I have absolutely no idea to debug the sh file, so can you suggest how i can do the debugging?,if i get the detailed idea, i would be better.

If there any tool/IDE that i can install on window machine and do the debugging
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you say "error" do you mean syntax error or it doesn't do what you want it to?

The easiest way to debug the former is to comment out code until you have a script that doesn't blow up and slowly start adding code back in. The easiest way to debug the later is to add echo statements. I've never used a tool because the UNIX systems I've had access to blocked a UI and command line debugging wouldn't have been easier than what I was doing.
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sh -x myscript.sh

That at least shows you the commands as they execute. Also, put in lots of echo statements. If you're doing anything really complicated, I recommend looking into Python as an alternative to Bourne Shell scripts. Or Perl ... Perl still exists, right?
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic