Linux HOWTOs

About | Home | Search


HOWTO: sh-utils
Description: Shell programming utilities
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# fileutils, sh-utils, and textutils have all been combined into coreutils.
# Unless you specifically need to use the individual old packages, you should
# move to coreutils instead of installing/upgrading sh-utils.

# The latest version of sh-utils that was created before coreutils was
# released was version 2.0.15, according to the sh-utils home page.  It's
# available here:
# ftp://alpha.gnu.org/gnu/coreutils/sh-utils-2.0.15.tar.bz2
# ...but don't be surprised if it goes away in the future.  Based on the
# fact that this version is available at alpha.gnu.org and not ftp.gnu.org,
# that would normally indicate that it's an alpha or beta version.

# I haven't used sh-utils in a long time, if you find anything broken in
# here, let me know (e-mail link is at the bottom).


# GNU shellutils (sh-utils) 2.0
# =============================
# sh-utils 2.0 already comes with (at least) Slackware 8.0, 8.1, and 9.0
# It was released August 14, 1999.  Slackware 7.0 was released in November
# of 1999, I haven't checked, but it was probably included that far back
# too.

# Prerequisites:
# tar
# perl
# bison
# texinfo (optional; for makeinfo)

cd
test -f installed/sh-utils-2.0.tar.gz && mv installed/sh-utils-2.0.tar.gz .
test ! -f sh-utils-2.0.tar.gz &&
 wget http://ftp.gnu.org/gnu/sh-utils/sh-utils-2.0.tar.gz

# Verify tarball w/ md5sum:
echo "5e78d1d48ca563ca77e96b22406c4aaf  sh-utils-2.0.tar.gz" | md5sum -c

# Don't 'removepkg sh-utils' after 'make' below.  That would kill echo
# and such, which 'make install' requires to exist.

mkdir -p -m 0700 src
cd src
tar xzvf ~/sh-utils-2.0.tar.gz
cd sh-utils-2.0
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --disable-nls
make
make check

# Become root to clean up old files and to install it
su
find /usr/doc -maxdepth 1 -type d -name "sh-utils-*" -exec rm -r {} \;
rm -f /usr/info/sh-utils.info.gz /usr/man/cat1/date.1.gz
( cd /usr/man/man1 ; rm -f basename.1.gz chroot.1.gz date.1.gz dirname.1.gz \
  echo.1.gz env.1.gz expr.1.gz false.1.gz groups.1.gz hostid.1.gz id.1.gz \
  logname.1.gz nice.1.gz nohup.1.gz pathchk.1.gz pinky.1.gz printenv.1.gz \
  printf.1.gz pwd.1.gz sleep.1.gz stty.1.gz tee.1.gz test.1.gz true.1.gz \
  tty.1.gz uname.1.gz users.1.gz who.1.gz whoami.1.gz yes.1.gz )
find /usr/share/locale -type f -name "sh-utils.*" -exec rm {} \;
make install-strip
rm -f /usr/bin/hostname /usr/bin/su
find /var/adm/packages -type f -name "sh?utils*" \
 -exec mv -f {} /var/adm/removed_packages/ \;
find /var/adm/scripts -type f -name "sh?utils*" \
 -exec mv -f {} /var/adm/removed_scripts/ \;
( cd /usr/bin ; mv -f date echo false pwd sleep tty true uname /bin/ )
mv -f /usr/bin/chroot /usr/sbin/
ln -sf /usr/bin/test /usr/bin/[
ln -sf /bin/date /usr/bin/date
ln -sf /bin/echo /usr/bin/echo
ln -sf /bin/false /usr/bin/false
ln -sf /bin/pwd /usr/bin/pwd
ln -sf /bin/sleep /usr/bin/sleep
ln -sf /bin/stty /usr/bin/stty
ln -sf /bin/true /usr/bin/true
ln -sf /bin/uname /usr/bin/uname

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/sh-utils-*.tar.*
mv sh-utils-2.0.tar.gz installed/

# Here are the differences between the Slack package and the source.  Left
# side is Slack, right side is source.  Above, we made it exactly like
# Slack's so it can be a total replacement.
#
# /bin/date		/usr/bin/date
# /bin/echo		/usr/bin/echo
# /bin/false		/usr/bin/false
# /bin/pwd		/usr/bin/pwd
# /bin/sleep		/usr/bin/sleep
# /bin/tty		/usr/bin/tty
# /bin/true		/usr/bin/true
# /bin/uname		/usr/bin/uname
# /usr/sbin/chroot	/usr/bin/chroot
#
# Also, Slack leaves out hostname (in favor of the one in net-tools) and
# su (also in shadow).

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>