Online Book Reader

Home Category

Classic Shell Scripting - Arnold Robbins [212]

By Root 851 0
retrieve the file:

$ ftp ftp.gnu.org

FTP to server

Connected to ftp.gnu.org (199.232.41.7).

220 GNU FTP server ready.

Name (ftp.gnu.org:tolstoy): anonymous

Anonymous login

230 Login successful.

230-Due to U.S. Export Regulations, all cryptographic software on this

230-site is subject to the following legal notice:

...

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> cd /gnu/bash

Change to bash directory

250 Directory successfully changed.

ftp> binary

Ensure binary mode

200 Switching to Binary mode.

ftp> hash

Print # marks for feedback

Hash mark printing on (1024 bytes/hash mark).

ftp> get bash-3.0.tar.gz

Retrieve file

local: bash-3.0.tar.gz remote: bash-3.0.tar.gz

227 Entering Passive Mode (199,232,41,7,149,247)

150 Opening BINARY mode data connection for bash-3.0.tar.gz (2418293 bytes).

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

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

...

226 File send OK.

2418293 bytes received in 35.9 secs (66 Kbytes/sec)

ftp> quit

All done

221 Goodbye.

Besides the bash distribution itself, you should also retrieve any patches. For Version 3.0 of bash, the patches—fixes to the source code that should be applied—must be retrieved from a different site. They're found in ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/. You can retrieve all of them into a temporary directory as follows:

$ mkdir /tmp/p

Make temporary directory

$ cd /tmp/p

Move there

$ for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16

> do wget ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/bash30-0$i

> done

Retrieve all patches

... lots of output omitted ...

As of this writing, there are 16 patches. There may be more or fewer, depending upon the version of bash and what's been made available.

Now you're ready to extract the distribution and apply the patches. First, extract the source code:

$ gzip -d < bash-3.0.tar.gz | tar -xpvzf -

Decompress and extract

bash-3.0/

bash-3.0/CWRU/

bash-3.0/CWRU/misc/

bash-3.0/CWRU/misc/open-files.c

bash-3.0/CWRU/misc/sigs.c

... lots of output omitted ...

Now apply the patches:

$ cd bash-3.0

Change to source directory

$ for i in /tmp/p/*

Apply all patches

> do patch -p0 --verbose --backup < $i

> done

... lots of output omitted ...

$ find . -name '*.rej'

Check for failures

$ find . -name '*.orig' -print | xargs rm

Clean up

The invocation of patch just shown assumes the GNU version of patch. Beware of the older versions that are supplied on some commercial Unix systems. After applying the patches, we check for failed patches by looking for .rej (reject) files. Here, there were none, so we're OK. We then remove the .orig (original) files. Building bash follows the standard GNU recipe:

$ ./configure && make && make check

Configure, build, and test

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

... lots of output omitted ...

If all the tests pass (they should), that's it, you're all set! Use make install to install the freshly built bash executable. (You may need to do the installation step as root.)

ksh93

ksh93 can be downloaded in source code form from the AT&T Research web site. The URL is http://www.research.att.com/sw/download. Building ksh93 is relatively straightforward, but the process is somewhat more manual than for bash. We show the steps for ksh93p, from February 2004. The steps will be similar for whatever version is current. We've chosen here to just build the Korn shell, although you may wish to download and build the entire "AST Open" package, because that provides a full set of tools.

From the web site, download the packages INIT.2004-02-29.tgz and ast-ksh.2004-02-29.tgz. Place them in an otherwise empty directory that you will use for building the software.

Make the directory lib/package/tgz and move the two files there:$ mkdir -p lib/package/tgz

$ mv *.tgz lib/package/tgz

Extract the INIT package manually:$ gzip -d < lib/package/tgz/INIT.2004-02-29.tgz | tar

Return Main Page Previous Page Next Page

®Online Book Reader