How To Enable Shell Script Debugging Mode in Linux
How To Enable Shell Script Debugging Mode in Linux
How To Enable Shell Script Debugging Mode in Linux
com/enable-shell-debug-mode-linux/
Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators | 4 Free Shell Scripting
eBooks SHARE
sequence of commands by typing them one by one all the time on the
terminal, a system user can store all of them (commands) in a le and
repeatedly invokes the le to re-execute the commands several times. 0
1 di 7 28/11/2016 19:40
How To Enable Shell Script Debugging Mode in Linux http://www.tecmint.com/enable-shell-debug-mode-linux/
RedHat RHCSA and RHCE Certication Exam Study Ebook ($35) Get This Book
A script is distinguished from other les by its rst line, that contains a #!
(She-bang denes the le type) and a path name (path to interpreter)
which informs the system that the le is a collection of commands that
will be interpreted by the specied program (interpreter).
Another possible form is by clearly specifying the shell that will execute
the script as below:
For example:
2 di 7 28/11/2016 19:40
How To Enable Shell Script Debugging Mode in Linux http://www.tecmint.com/enable-shell-debug-mode-linux/
RedHat RHCSA and RHCE Certication Exam Study Ebook ($35) Get This Book
-v (short for verbose) tells the shell to show all lines in a script
while they are read, it activates verbose mode.
-n (short for noexec or no ecxecution) instructs the shell read all
the commands, however doesnt execute them. This options activates
syntax checking mode.
-x (short for xtrace or execution trace) tells the shell to display all
commands and their arguments on the terminal while they are
executed. This option enables shell tracing mode.
#!/bin/sh option(s)
For example:
3 di 7 28/11/2016 19:40
How To Enable Shell Script Debugging Mode in Linux http://www.tecmint.com/enable-shell-debug-mode-linux/
RedHat RHCSA and RHCE Certication Exam Study Ebook ($35) Get This Book
section of a shell script such as a function. This mechanism is important,
as it allows us to activate debugging at any segment of a shell script.
We can turn on debugging mode using set command in form below, where
option is any of the debugging options.
$ set option
$ set -option
$ set +option
$ set -
That is it for now with enabling shell script debugging mode. As we have
seen, we can either debug an entire shell script or a particular section of a
script.
In the next two episode of this series, we will cover how to use the shell
script debugging options to explain verbose, syntax checking and shell
tracing debugging modes with examples.
4 di 7 28/11/2016 19:40
How To Enable Shell Script Debugging Mode in Linux http://www.tecmint.com/enable-shell-debug-mode-linux/
RedHat RHCSA and RHCE Certication Exam Study Ebook ($35) Get This Book
3. Use our Linode referral link if you plan to buy VPS (it starts at only
$10/month).
Your name can also be listed here. Got a tip? Submit it here to
become an TecMint author.
5 di 7 28/11/2016 19:40
How To Enable Shell Script Debugging Mode in Linux http://www.tecmint.com/enable-shell-debug-mode-linux/
RedHat RHCSA and RHCE Certication Exam Study Ebook ($35) Get This Book
Find Out All Live Hosts IP Addresses Cyber Monday SALE: Save an Extra 25% Off
Connected on Network in Linux On Our Security Deals For One Day Only
10 4 0
3 RESPONSES
Comments 3 Pingbacks 0
6 di 7 28/11/2016 19:40
How To Enable Shell Script Debugging Mode in Linux http://www.tecmint.com/enable-shell-debug-mode-linux/
RedHat RHCSA and RHCE Certication Exam Study Ebook ($35) Get This Book
Reply
It is a typo and thanks for catching that, we shall correct it and update the article.
Reply
Comment
Name * Email *
Website
Notify me of followup comments via e-mail. You can also subscribe without commenting.
Post Comment
7 di 7 28/11/2016 19:40