Use only ln, display error messages in stderr

This commit is contained in:
eeva 2016-03-19 18:43:01 +01:00
parent 3f8dc335a0
commit d4d3289216

View file

@ -40,13 +40,13 @@ fi
STATE="$STATE1$STATE2" STATE="$STATE1$STATE2"
case $STATE in case $STATE in
[89]* ) [89]* )
echo "$F1 is not a proper file (or a non-existent one)" >&2 echo "$F1 is not a proper file (or a non-existent one)"
echo "Note that only regular files and directories are allowed" >&2 echo "Note that only regular files and directories are allowed"
exit $STATE exit $STATE
;; ;;
*[89] ) *[89] )
echo "$F2 can not be created (containing directory does not exist)" >&2 echo "$F2 can not be created (containing directory does not exist)"
echo "or exists already (refusing to overwrite)" >&2 echo "or exists already (refusing to overwrite)"
exit $STATE exit $STATE
;; ;;
[01]0 ) # file or dir to an existing dir [01]0 ) # file or dir to an existing dir
@ -68,7 +68,5 @@ esac
#echo $DEGUB #echo $DEGUB
# Step 4: eventually act upon gathered knowledge ############################### # Step 4: eventually act upon gathered knowledge ###############################
mv $PATH1 $PATH2 ln $PATH1 $PATH2 # Hard link to new location (fast!)
cd $(dirname $PATH1) ln -sf $PATH2 $PATH1 # Soft link back to old location
ln -s $PATH2 $(basename $PATH1)