Script conversion from csh --> sh

Script conversion from csh --> sh

Post by Thomas Grunenbe » Sat, 12 Jun 1993 02:47:35



I have just installed xv3.00. The Makefiles invoke './RANLIB.csh'
(seen below) ...

==> RANLIB.csh <==
#!/bin/csh -f
#
# tests to see if the program 'ranlib' exists.  If it does, runs ranlib on
# the first argument (a library name).  Otherwise, does nothing, and returns
#
# written by John Bradley for the XV 3.00 release
# thanks to John Hagan for shell-script hackery
#

echo "executing 'ranlib $1'..."

# Is there a ranlib?  Let's try and then suffer the consequences...
set haveranlib = `ranlib $1 >& /dev/null`

if ( $status ) then
        echo "There doesn't seem to be a ranlib on this system..."
        echo "Don't worry about it."
endif

echo ""
echo ""
==> END: RANLIB.csh <==

Under LINUX i'm only used in using 'bash'. So I try to convert the script
for bash. NOW MY QUESTION: Are the scripts equivalent??

==> RANLIB.sh <==
#    #!/bin/csh -f
#
# tests to see if the program 'ranlib' exists.  If it does, runs ranlib on
# the first argument (a library name).  Otherwise, does nothing, and returns
#
# written by John Bradley for the XV 3.00 release
# thanks to John Hagan for shell-script hackery
#

echo "executing 'ranlib $1'..."

# Is there a ranlib?  Let's try and then suffer the consequences...
haveranlib=`ranlib $1 > /dev/null 2>&1`
STATUS=$?

# echo haveranlib = XXX${haveranlib}XXX
# echo STATUS = $STATUS

if test $STATUS -ne 0 ; then
        echo "There doesn't seem to be a ranlib on this system..."
        echo "Don't worry about it."
fi

echo ""
echo ""
==> END: RANLIB.sh <==

Thanx
Thomas
--
Thomas Grunenberg, Kirchhofallee 12, 2300 Kiel 1, (24103 Kiel)