Skip to content

Commit

Permalink
added check of in arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
filantrop committed Feb 12, 2015
1 parent 3d6ad1e commit 0c1e7ce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rename_symboliclinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ SOURCEDIR=$1
FIND=$2
REPLACE=$3

if [ "$#" -ne 3 ];then echo 'Call this script with e.g. /data/disk/o1/distro/001/ebiz-1.3.1 "drupal\-7\.28\.1" "drupal-7.32.1"';exit 0;fi

if [ -z "$SOURCEDIR" ];then echo "SOURCEDIR is not given";exit 0;fi
if [ ! -d "$SOURCEDIR" ];then echo "$SOURCEDIR does not exist";exit 0;fi
if [ -z "$FIND" ];then echo "FIND is not given";exit 0;fi
if [ -z "$REPLACE" ];then echo "REPLACE is not given";exit 0;fi

# Code
cd $SOURCEDIR
Expand All @@ -27,5 +33,6 @@ for SOURCEFILE in $FILES; do
ln -s $RESULT ${SOURCEFILE}_newfile_torename
rm $SOURCEFILE
mv ${SOURCEFILE}_newfile_torename $SOURCEFILE
chown -h o1:users $SOURCEFILE
fi
done

0 comments on commit 0c1e7ce

Please sign in to comment.