From a294b5d81b13483b4fa0a5e68d1417f9b8951336 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Sun, 8 Mar 1998 15:28:37 +0000 Subject: [PATCH] Improve shell variable substitution. --- usr.bin/locate/locate/concatdb.sh | 18 ++++++++---------- usr.bin/locate/locate/mklocatedb.sh | 16 +++++++--------- usr.bin/locate/locate/updatedb.sh | 20 +++++++++----------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/usr.bin/locate/locate/concatdb.sh b/usr.bin/locate/locate/concatdb.sh index dd16230d05ea..66f2cfbb3f8d 100644 --- a/usr.bin/locate/locate/concatdb.sh +++ b/usr.bin/locate/locate/concatdb.sh @@ -30,25 +30,23 @@ # # Sequence of databases is important. # -# $Id: concatdb.sh,v 1.5 1997/02/22 19:55:45 peter Exp $ +# $Id: concatdb.sh,v 1.6 1997/12/13 18:18:07 sef Exp $ # The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR +: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH umask 077 # protect temp files -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR; -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR -fi +: ${TMPDIR:=/tmp}; export TMPDIR; +test -d "$TMPDIR" || TMPDIR=/tmp # utilities to built locate database -: ${bigram=locate.bigram} -: ${code=locate.code} -: ${sort=sort} -: ${locate=locate} +: ${bigram:=locate.bigram} +: ${code:=locate.code} +: ${sort:=sort} +: ${locate:=locate} case $# in diff --git a/usr.bin/locate/locate/mklocatedb.sh b/usr.bin/locate/locate/mklocatedb.sh index 4021dfcb27b0..30839a2ba6a1 100644 --- a/usr.bin/locate/locate/mklocatedb.sh +++ b/usr.bin/locate/locate/mklocatedb.sh @@ -28,25 +28,23 @@ # # usage: mklocatedb [-presort] < filelist > database # -# $Id: mklocatedb.sh,v 1.4 1997/02/22 19:55:49 peter Exp $ +# $Id: mklocatedb.sh,v 1.5 1997/12/13 18:18:10 sef Exp $ # The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR +: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH umask 077 # protect temp files -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR -fi +: ${TMPDIR:=/tmp}; export TMPDIR +test -d "$TMPDIR" || TMPDIR=/tmp # utilities to built locate database -: ${bigram=locate.bigram} -: ${code=locate.code} -: ${sort=sort} +: ${bigram:=locate.bigram} +: ${code:=locate.code} +: ${sort:=sort} sortopt="-u -T $TMPDIR" diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh index d0e4b62e85d6..79d5538ddd06 100644 --- a/usr.bin/locate/locate/updatedb.sh +++ b/usr.bin/locate/locate/updatedb.sh @@ -26,7 +26,7 @@ # # updatedb - update locate database for local mounted filesystems # -# $Id: updatedb.sh,v 1.7 1997/02/22 19:55:49 peter Exp $ +# $Id: updatedb.sh,v 1.8 1997/12/13 18:18:12 sef Exp $ LOCATE_CONFIG="/etc/locate.rc" if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then @@ -34,21 +34,19 @@ if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then fi # The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR -fi +: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR +: ${TMPDIR:=/tmp}; export TMPDIR +test -d "$TMPDIR" || TMPDIR=/tmp PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH -: ${mklocatedb=locate.mklocatedb} # make locate database program -: ${FCODES=/var/db/locate.database} # the database -: ${SEARCHPATHS="/"} # directories to be put in the database +: ${mklocatedb:=locate.mklocatedb} # make locate database program +: ${FCODES:=/var/db/locate.database} # the database +: ${SEARCHPATHS:="/"} # directories to be put in the database : ${PRUNEPATHS="/tmp /usr/tmp /var/tmp"} # unwanted directories -: ${FILESYSTEMS="ufs"} # allowed filesystems -: ${find=find} +: ${FILESYSTEMS:="ufs"} # allowed filesystems +: ${find:=find} case X"$SEARCHPATHS" in X) echo "$0: empty variable SEARCHPATHS"; exit 1;; esac