[Dart-dev] [6454] DART/trunk/mpi_utilities/fixsystem: on debian and ubuntu systems / bin/sh is now a link to 'dash'
nancy at ucar.edu
nancy at ucar.edu
Tue Sep 3 05:20:36 MDT 2013
Revision: 6454
Author: nancy
Date: 2013-09-03 05:20:36 -0600 (Tue, 03 Sep 2013)
Log Message:
-----------
on debian and ubuntu systems /bin/sh is now a link to 'dash'
which is a stripped down shell. on some systems /bin/sh
links to bash; on these it links to dash. this script now
uses a subset of the shell syntax that works ok for both.
also tested to be ok with ksh and zsh.
Modified Paths:
--------------
DART/trunk/mpi_utilities/fixsystem
-------------- next part --------------
Modified: DART/trunk/mpi_utilities/fixsystem
===================================================================
--- DART/trunk/mpi_utilities/fixsystem 2013-09-03 09:44:01 UTC (rev 6453)
+++ DART/trunk/mpi_utilities/fixsystem 2013-09-03 11:20:36 UTC (rev 6454)
@@ -37,10 +37,10 @@
do
# figure out what state the source file is in before we start
- export bline=`fgrep SYSTEM_BLOCK_EDIT ${f} | grep START | head -n 1`
- if [[ "`echo $bline | grep COMMENTED_OUT`" != "" ]]; then
+ export bline="`fgrep SYSTEM_BLOCK_EDIT ${f} | grep START | head -n 1`"
+ if [ "`echo $bline | grep COMMENTED_OUT`" != "" ]; then
export before=out
- elif [[ "`echo $bline | grep COMMENTED_IN`" != "" ]]; then
+ elif [ "`echo $bline | grep COMMENTED_IN`" != "" ]; then
export before=in
else
echo ${f} not found, or does not have the right comment string to
@@ -50,13 +50,13 @@
exit 1
fi
- if [[ $# == 0 ]]; then
+ if [ $# = 0 ]; then
# no args given, swap to the other configuration. deprecated
# and eventually a single argument will become required.
- if [[ $before == out ]]; then
+ if [ $before = out ]; then
export todo=in
export compiler=non-gfortran
- elif [[ $before == in ]]; then
+ elif [ $before = in ]; then
export todo=out
export compiler=gfortran
else
@@ -64,16 +64,16 @@
exit 1
fi
- elif [[ $# == 1 ]]; then
+ elif [ $# = 1 ]; then
# single arg: the name of your fortran compiler command
- if [[ "$1" == help || "$1" == -help || "$1" == --help ]]; then
+ if ([ "$1" = help ] || [ "$1" = -help ] || [ "$1" = --help ]); then
echo "usage: $0 [ your_fortran_command_name | -help ]"
echo " e.g. $0 gfortran"
echo " or $0 ifort "
echo " or $0 pgf90 "
echo " etc."
exit 1
- elif [[ "$1" == gfortran ]]; then
+ elif [ "$1" = gfortran ]; then
export todo=out
else
export todo=in
@@ -92,13 +92,13 @@
fi
# if we are already in the right state, loop to next file
- if [[ $before == out && $todo == out ]]; then continue; fi
- if [[ $before == in && $todo == in ]]; then continue; fi
-
+ if ([ $before = out ] && [ $todo = out ]); then continue; fi
+ if ([ $before = in ] && [ $todo = in ]); then continue; fi
+
# we do have something do to
# save original copy for backup if one does not already exist.
- if [[ ! -f ${f}.orig ]]; then
+ if [ ! -f ${f}.orig ]; then
cp -p ${f} ${f}.orig
fi
@@ -108,13 +108,13 @@
mv ${f} tempfile
# removing comment chars, enabling interface block code
- if [[ $todo == in ]]; then
+ if [ $todo = in ]; then
sed -e '/SYSTEM_BLOCK_EDIT START COMMENTED_OUT/,/SYSTEM_BLOCK_EDIT END COMMENTED_OUT/s/^!//' \
-e '/\(SYSTEM_BLOCK_EDIT [A-Z][A-Z]*\) COMMENTED_OUT/s//\1 COMMENTED_IN/' tempfile > ${f}
fi
# adding comment chars, disabling interface block code
- if [[ $todo == out ]]; then
+ if [ $todo = out ]; then
sed -e '/SYSTEM_BLOCK_EDIT START COMMENTED_IN/,/SYSTEM_BLOCK_EDIT END COMMENTED_IN/s/^/!/' \
-e '/\(SYSTEM_BLOCK_EDIT [A-Z][A-Z]*\) COMMENTED_IN/s//\1 COMMENTED_OUT/' tempfile > ${f}
fi
More information about the Dart-dev
mailing list