Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

Bash on AIX

News

See also

Ksh93 and Bash Shells Bash Recommended Links Bash and ksh93 Shell Prompts Customarization
Advanced Unix filesystem navigation Shell Command Line History Substitution Command completion Shell Command Line History Substitution   Ksh93
Shell profile and RC-files Pushd, popd and dirs cdpath Unix alias command and shell aliases Humor Etc

RPM of version bash 3.2 for AIX 5.3 is available at

http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/download.html

The installation requires one command:

rpm -i bash-3.2-1.aix5.2.ppc.rpm

You need also include it into the list of shells to use with FTP.

If you need a refresher information, see Bash as an Enterprise-level Shell. The topics include short explanations of key features and techniques for system administrators, such as


Notes:
  • This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Some amount of grammar and spelling errors should be expected.
  • The site contain some broken links as it develops like a living tree... Please try to use Google, Open directory, etc. to find a replacement link (see HOWTO search the WEB for details). We would appreciate if you can mail us a correct link.
Google Search
Open directory

Research Index


Old News ;-)

[Apr 7, 2009] Mastering Unix Shell Scripting: Bash, Bourne, and Korn Shell Scripting for Programmers, System Administrators, and UNIX Gurus (Paperback)

This is one of the few book with some AIX bias. For example,  Chapter 11 is about AIX Logical Volume Manager. That author also wrote a great book on AIX administration

by Randal K. Michael (Author)

From foreword:

We urge everyone to study this entire book. Every chapter hits a different topic

using a different approach. The book is written this way to emphasize that there is

never only one technique to solve a challenge in UNIX. All the shell scripts in this book

are real-world examples of how to solve a problem. Thumb through the chapters, and

you can see that we tried to hit most of the common (and some uncommon!) tasks

in UNIX. All the shell scripts have a good explanation of the thinking process, and

we always start out with the correct command syntax for the shell script targeting a

specific goal. I hope you enjoy this book as much as I enjoyed writing it. Let’s get

started!

4.0 out of 5 stars A must-have for all levels of *nix users. , August 1, 2004
By  Bindlestiff (rixtertech.com) - See all my reviews
The breadth of real-world examples make the difference between this book and most reference texts. It's true that it's written for korn, but I've had little trouble adapting for Bash; many of the scripts run almost unchanged and the ones that don't provide a useful opportunity for exercise in adaptation. The authors prose is clear. His attitude is a bit challenging; he says early on that that his intention is to teach you how to -solve problems- by shell scripting, NOT to present a ream of canned solutions. This is NOT a reference text for any particular shell, you'll still need plenty of O'Reilly books, a web browser & etc.

This book has enabled me to write a major project using scripting as the glue to hold together a hefty mass of file-moving daemons, fax/paging engines, python UI code, PostGreSQL database engine, networking/email, SSH, and Expect scripts on a Gnu Linux platform. I absolutely could not have done it without this book and I'm very grateful to Mr Michael for his work. If a later edition could more closely serve the needs of the masses by presenting more Bash examples and maybe throwing in a CD it would be a 5-star text.

Quote

Command readability and step-by-step comments are just the very basics of a

well-written script. Using a lot of comments will make our life much easier when we

have to come back to the code after not looking at it for six months, and believe me; we

will look at the code again. Comment everything! This includes, but is not limited to,

describing what our variables and files are used for, describing what loops are doing,

describing each test, maybe including expected results and how we are manipulating

the data and the many data fields. A hash mark, #, precedes each line of a comment.

The script stub that follows is on this book’s companion web site at www.wiley.com/

go/michael2e. The name is script.stub. It has all the comments ready to get started

writing a shell script. The script.stub file can be copied to a new filename. Edit the

new filename, and start writing code. The script.stub file is shown in Listing 1-1.

#!/bin/Bash

#

# SCRIPT: NAME_of_SCRIPT

# AUTHOR: AUTHORS_NAME

# DATE: DATE_of_CREATION

# REV: 1.1.A (Valid are A, B, D, T and P)

# (For Alpha, Beta, Dev, Test and Production)

#

# PLATFORM: (SPECIFY: AIX, HP-UX, Linux, OpenBSD, Solaris

# or Not platform dependent)

#

# PURPOSE: Give a clear, and if necessary, long, description of the

# purpose of the shell script. This will also help you stay

# focused on the task at hand.

#

# REV LIST:

# DATE: DATE_of_REVISION

# BY: AUTHOR_of_MODIFICATION

# MODIFICATION: Describe what was modified, new features, etc--

#

#

# set -n # Uncomment to check script syntax, without execution.

# # NOTE: Do not forget to put the comment back in or

# # the shell script will not execute!

# set -x # Uncomment to debug this shell script

#

##########################################################

# DEFINE FILES AND VARIABLES HERE

##########################################################

Listing 1-1 script.stub shell script starter listing

Michael c01.tex V4 - 03/24/2008 4:45pm Page 8

8 PartIThe Basics of Shell Scripting

##########################################################

# DEFINE FUNCTIONS HERE

##########################################################

##########################################################

# BEGINNING OF MAIN

##########################################################

# End of script

Listing 1-1 (continued)

The shell script starter shown in Listing 1-1 gives you the framework to start writing

the shell script with sections to declare variables and files, create functions, and write

the final section, BEGINNING OF MAIN, where the main body of the shell script is

written.

Linux - Aix Administration - Tips & Stuff Bash Shortcuts and Tips

Bash Shortcuts and Tips
 
Repeating an argument
You can repeat the last argument of the previous command in multiple ways. Have a look at this example:

$ mkdir /path/to/dir
$ cd !$

The second command might look a little strange, but it will just cd to /path/to/dir.

Some keyboard shortcuts for editing

There are some pretty useful keyboard shortcuts for editing in bash. They might appear familiar to Emacs users:

• Ctrl + a => Return to the start of the command you're typing
• Ctrl + e => Go to the end of the command you're typing
• Ctrl + u => Cut everything before the cursor to a special clipboard
• Ctrl + k => Cut everything after the cursor to a special clipboard
• Ctrl + y => Paste from the special clipboard that Ctrl + u and Ctrl + k save their data to
• Ctrl + t => Swap the two characters before the cursor (you can actually use this to transport a character from the left to the right, try it!)
• Ctrl + w => Delete the word / argument left of the cursor
• Ctrl + l => Clear the screen

Redirecting both Standard Output and Standard Error:

# ls -ltR 2>&1 > /tmp/temp.txt

Specify this in .bashrc

Make Bash append rather than overwrite the history on disk:

# shopt -s histappend

Whenever displaying the prompt, write the previous line to disk:

# export PROMPT_COMMAND=’history -a’

To erase duplicate entries in History.

# export HISTCONTROL=erasedups
(or)
# export HISTCONTROL=ignoreboth

To see the history with timestamps

# export HISTTIMEFORMAT="%d/%m/%Y-%H:%M:%S "

To set the Size of the history HISTSIZE: The number of commands to remember in the command history. The default value is 500.

# export HISTSIZE=500

Searching the Past
  This will put bash in history mode, allowing you to type a part of the command you're looking for. In the meanwhile, it will show the most recent occasion where the string you're typing was used. If it is showing you a too recent command, you can go further back in history by pressing Ctrl + r again and again. Once you found the command you were looking for, press enter to run it.

 

 

shpot4@yahoo.com wrote:
 

> Is bash part of the AIX 5.3 base installation, or an additional fileset
> that I need to install? Or do I need install from source or possibly
> from AIX Toolbox for Linux Applications?
>
> Thanks in advance
> Cheers!
 

 

Ick.
 

Sorry, couldn't help it. Since Bash is listed on the AIX Toolbox page I
suspect it's not a part of the base installation. It should be on the
Toolbox CD or you can get it from this site:
http://www-03.ibm.com/servers/aix/products/aixos/linux/download.html

 

bash-vim-on-aix-485657

 

both bash and viM are installed in my home folder. i have added their location in my PATH. the arrows work now by setting TERM to xterm instead of ansi. i can deal with Home and End keys not working.



Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: August 15, 2009