Oracle Shell Scripting review – Excellent read!

My book, Oracle Shell Scripting has received another 5-star review on Amazon!

A. Tucker “Rat” writes:

Oracle administrators of all levels will find benefit in this book. The author has put together the basics in shell scripting and OS fundamentals in aid of maintaining and monitoring scalable production Oracle environments. Each example is easy to read and follow and leaves the reader with room to explore and extrapolate on their own with little effort. A great lookup source for old timers and “must have” for newbies.

I highly recommend this book
-Rat

Thanks for the great review Rat!

Oracle Shell ScriptingCheck out my book Oracle Shell Scripting, only $34.95 from Rampant TechPress.

Buy it now!


Linux and UNIX shell variables

Shell variables give us a place to store values for use by the system, our shell, shell scripts or by programs we run. Each session in UNIX has a set of variables that collectively are referred to as the environmental variables. These variables tell the system where to find applications and documentation, where the user’s home directory is, the current working directory and much more. You can easily view all the environmental variables in the current session with the env command:

$ env
TERM=vt102
SHELL=/bin/bash
SSH_CLIENT=192.168.2.1 54620 22
OLDPWD=/export/home/oracle
SSH_TTY=/dev/pts/1
USER=oracle
MAIL=/var/mail//oracle
PATH=/usr/bin:/usr/ucb:/etc:.
PWD=/u01
TZ=US/Eastern
PS1=$
SHLVL=1
HOME=/export/home/oracle
LOGNAME=oracle
SSH_CONNECTION=192.168.2.1 54620 192.168.2.100 22
_=/usr/bin/env

These are some of the default variables provided by the system. As Oracle users we’re also familiar with shell variables such as $ORACLE_HOME and $ORACLE_SID.

While most of the environmental variables in the output above are set by the system, variables like $ORACLE_HOME need to be set by the user. In the bourne and bash shells, environmental variables are set by giving the variable name, the equal sign (=) and then the value the variable should be set to. The variable must then be exported with the export command so it can become available to subsequent commands.

$ ORACLE_HOME=/u01/app/oracle/product/10.2.0/Db_1
$ export ORACLE_HOME
$ echo $ORACLE_HOME
/u01/app/oracle/product/10gR2/db_1

When setting variables you simply use the variable name; however, as we see in the above example we use the $ prefix to retrieve the value of a variable. You may also see the variable definition followed by the export on the same line separated by a semicolon. The semicolon marks the end of the first command allowing the commands to be executed as if they were on separate lines.

These exported environmental variables typically affect how UNIX and Linux behave or how other commands run. Though not a rule, environmental variable names are typically all uppercase. Lowercase variable names are typically used for local shell variables that are only needed in the current session or script. Local shell variables need not be exported.

$ day=Monday
$ echo $day
Monday

It’s important to remember that shell variables are specific to a session, not a user. That means if you change the environment variables in one session it will not have any effect on other active sessions.

Beyond the familiar Oracle related shell variables we’ll be using shell variables for storing date information, file and directory names, passwords and much more.

Oracle Shell ScriptingFor more information like this check out my book Oracle Shell Scripting, only $34.95 from Rampant TechPress.

Buy it now!


Oracle Shell Scripting: Another 5-star review!

Well, I’m glad to see that people are liking my book Oracle Shell Scripting: Linux and UNIX Programming for Oracle. Another 5-star review showed up on Amazon last week:

Jolly writes:

Great book!

A well written book. A great way to learn shell scripting. Relevant and useful examples throughout the book (downloadable code).

Thanks for the review Jolly!

Oracle Shell ScriptingFor more information like this check out my book Oracle Shell Scripting, only $34.95 from Rampant TechPress.

Buy it now!


What shell am I in?

When you connect to a system, whether directly on the system’s keyboard or through a remote connection you will automatically start in your default shell. The default shell was originally assigned to you when your account was created.

To find out what shell you are currently using we can use the echo command:

$ echo $SHELL
/bin/bash

In this command we are using the echo command to examine the value of the environment variable $SHELL. This variable was set by the system when we started this command line session and shows the full path to the shell we were assigned at login. Here are some common shells you might see:

  • /bin/sh – Bourne shell
  • /bin/bash – Bourne Again shell
  • /bin/csh – C shell
  • /bin/ksh – Korn shell
  • /bin/tcsh – TC shell
  • /bin/zsh – Z shell

Shell binaries are also commonly found in the /usr/local/bin directory. Consult your system administrator if you’re having trouble finding your shell binaries.

Oracle Shell ScriptingFor more information like this check out my book Oracle Shell Scripting, only $34.95 from Rampant TechPress.

Buy it now!


Oracle Shell Scripting, another review

Another review for my book Oracle Shell Scripting: Linux and UNIX Programming for Oracle has shown up on Amazon!

Prashant wrote:

This book has helped me impress my colleagues and boss..I originally browsed through it at Border’s (and found myself sitting on the ground with a notepad scrambling to copy as much as possible)..of course, then I realized I had to have it, so I bought it online..I knew the publisher was a trustworthy source because I’m always using Don Burleson’s DBA tips online.. this author’s approach is easy-to-follow and concise; yet it’s a thorough guide that is like a catalyst for your own creativity…it has made me look forward to extracting the power of the shell.

It’s a lot better than parsing through thick UNIX encyclopedias or cycling through fragmented online material..as an OCP 10g/9i DBA, I still feel like there are not enough practical day-to-day guides like this one for junior/mid/senior-level administrators, since over half our work is directly/indirectly connected to the shell.

Thanks for the great review Prashant! After all the work that goes into a book like this it’s great to know that it’s helping people. That’s what it’s all about, after all.

Oracle Shell ScriptingFor more information like this check out my book Oracle Shell Scripting, only $34.95 from Rampant TechPress.

Buy it now!