- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Where to find one Shell Script Programming Editor
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 10:57 PM
07-09-2002 10:57 PM
I am a freshman towards shell script programming. Recently I have written a shell script which is about 300 sentences long. I just know to write a file with shell commands and then execute it directly under the current shell. Then some grammar errors occur. Grammar errors are relatively easy to position and correct but unfortunately there is some logical erros which are not easy to find without some tool aid. When I write C, I can find those logical errors easily with breakpoint or single step, etc. So I wonder whether there is some tools for shell programming providing the similar functions just as Turbo C. How and where can I get it? Thanks a lot!
Al.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 11:04 PM
07-09-2002 11:04 PM
Re: Where to find one Shell Script Programming Editor
do you know the command:
set -o xtrace (to turn on debugging mode)
set +o xtrace (to turn off debugging mode)
put the first command line as first line into your script, the second one as last line. You will get an output which shows you how the shell interprets a command line before executing it and after that the normal output of command lines.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 11:19 PM
07-09-2002 11:19 PM
Re: Where to find one Shell Script Programming Editor
That is good advice
man sh-posix and go to the bottom of page-13
there you will find
| set [{-|+}abCefhkmnopstuvx] [{-|+}o option]... [{-|+}A
name] [arg]...
There are lots of interesting things there
FYI
1)Easy way toprint man page
man $*|lp -dprinter -on -otl66 -ol70
2)see
http://www.introcomp.co.uk/unixadmin.html
Lots of example scripts
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 11:33 PM
07-09-2002 11:33 PM
Re: Where to find one Shell Script Programming Editor
But can I execute the shell program step by step or set some break points so that I can check the output interactively.
Al.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 11:39 PM
07-09-2002 11:39 PM
Re: Where to find one Shell Script Programming Editor
there is the possibility to let your script stop for a desired time period, use the command:
sleep time_in_seconds
to get the desired output, for example the value of a variable, you have to use the command:
echo $variable
which you can put into your script. To find logical errors, you can use the command:
if test $var -ne desired_value
then
exit 1
fi
With exit you can set a return code for your script. The values can be 0-255.
To check the return code of a command, do the following:
command_to_be_run
echo $?
this will give you the return code of the last command.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 11:53 PM
07-09-2002 11:53 PM
Re: Where to find one Shell Script Programming Editor
in the code at appropriate points put
echo "press any key to continue"
read char
so that unless u press any key it won't proceed
regds
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2002 11:59 PM
07-09-2002 11:59 PM
Re: Where to find one Shell Script Programming Editor
Al.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 12:07 AM
07-10-2002 12:07 AM
Re: Where to find one Shell Script Programming Editor
i am working as trainer for Hewlett Packard in Germany, and i do courses in shell programming. Sorry for the bad news, but i don't know a tool for debugging shell scripts in HP-UX or any other UNIX/Linux.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 12:07 AM
07-10-2002 12:07 AM
Re: Where to find one Shell Script Programming Editor
I'm attending an HP course right at this moment (writing this during a break :-) and the only thing the teacher can come up with (and which I already knew) is executing the script with "sh -x" in front of it.
When making large scripts, consider the use of functions. Makes it a lot easier ...
Regards,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 12:21 AM
07-10-2002 12:21 AM
Re: Where to find one Shell Script Programming Editor
So what I can do when I want to debug one shell program is to use 'set -o trace' or 'sh -x' and then add some self-designed 'echo' or other commands to trace the error at last?
I think perhaps you are right. Maybe people do not use shell script to develop large projects so that people think these small tools are enough to produce good programs.
Thanks everyone who remark.
AL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 05:17 AM
07-10-2002 05:17 AM
Re: Where to find one Shell Script Programming Editor
http://www.injunea.demon.co.uk/pages/page201.htm
http://steve-parker.org/sh/sh.shtml
http://www.cbi.cnptia.embrapa.br/manual/unix/unix_intro/Shell.html
The following link provides information on debugging that you may find of use:
http://www.injunea.demon.co.uk/pages/page213.htm
I have always found it easier when coding a large project to always split from the main program and call subroutines. Another coding hint would be to take a chunk at a time in a smaller script and when the code is correct, incorporate it into the larger script. This will prevent debugging the larger code all the time.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 07:01 AM
07-10-2002 07:01 AM
Re: Where to find one Shell Script Programming Editor
sh -x shellscript 2>&1 | more
The output of the tracing goes to stderr so it must be redirected to stdout and then piped to more. That way, you can run down the list until a problem occurs, then use CTRL-C to abort and you'll have the trace to that point. Note that functions called in the script will not inherit the -x (or set -x) option, so one technique is to export a TRACEON variable at the beginning of the script:
export TRACEON=/sbin/true
then in all the functions (and main too):
if $TRACEON || set -x
Another hint: always use set -u (you'll avoid big oops prob lems due to misspelled variables).
Another place to post your question is in Usenet: comp.unix.shell
And a great location for shell scripting techniques: www.shelldorado.com
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 09:33 AM
07-10-2002 09:33 AM
Re: Where to find one Shell Script Programming Editor
or the (shudder) Bourne shell. These are largely
compatible with the Korn shell, for which there is
a rudimentary but freely available debugger called
kshdb. Perhaps you can use kshdb to debug your
script.
I have not use kshdb in quite some time (for longer
scripting tasks I find Perl to be better suited) but
as I recall kshdb supports breakpoints and stepping.
You can also execute arbitrary shell commands
at the debugger prompt.
You can find more info on kshdb in the O'Reilly book
"Learning the Korn Shell"
(http://www.oreilly.com/catalog/korn2/).
In the past kshdb was available at ftp.uu.net. Perhaps
a web search will turn up its current location.
HTH

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 06:19 AM
07-11-2002 06:19 AM
Re: Where to find one Shell Script Programming Editor
HTH, Tom.
---
http://www.nedit.org : free software (GPL).
http://www.nedit.org/about/features.shtml
NEdit is a standard GUI (Graphical User Interface) style text editor for programs and plain-text files. Users of Macintosh and MS Windows based text editors should find NEdit a familiar and comfortable environment. NEdit provides all of the standard menu, dialog, editing, and mouse support, as well as all of the standard shortcuts to which the users of modern GUI based environments are accustomed. For users of older style Unix editors, welcome to the world of mouse-based editing!
...
Features for programmers
State of the art syntax highlighting with built-in patterns for C, C++, Java, Ada, FORTRAN, Pascal, Yacc, Perl, Python, Tcl, Csh, Awk, HTML, LaTeX, VHDL, Verilog, and more.
Auto-indent, programmable language-sensitive smart-indent.
Block indentation adjustment
Parenthesis flashing and matching
Find lines directly from compiler error output
Tab emulation
Unix ctags support
Client/Server mode for integration with software development tools.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2002 12:10 AM
07-12-2002 12:10 AM
Re: Where to find one Shell Script Programming Editor
Thanks for your sincere help.
I have downloaded this software.
It seems terrific.
I think I will try to use it and recommend it to others.
Al.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2002 12:12 PM
07-13-2002 12:12 PM
Solutionfor those who want to play with it on a rainy weekend:
http://www.nedit.org/ftp/v5_3/executables/nedit-5.3-hpux.tar.Z
other *ix:
http://www.nedit.org/ftp/v5_3/executables/
http://www.nedit.org/cgi-bin/ftpBrowser.pl?dir=contrib/highlighting