Removed hypothetical alg. notation support
This commit is contained in:
parent
3a0a3bc2cd
commit
c9247b0452
17
move.sh
17
move.sh
|
@ -8,15 +8,10 @@
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
na=0
|
na=0
|
||||||
algebraic_notation=0
|
|
||||||
force=0
|
force=0
|
||||||
for argument in $@
|
for argument in $@
|
||||||
do
|
do
|
||||||
case $argument in
|
case $argument in
|
||||||
-a)
|
|
||||||
na=1
|
|
||||||
algebraic_notation=1
|
|
||||||
;;
|
|
||||||
-f)
|
-f)
|
||||||
force=1
|
force=1
|
||||||
;;
|
;;
|
||||||
|
@ -28,7 +23,6 @@ do
|
||||||
else
|
else
|
||||||
if echo $argument | grep "," > /dev/null
|
if echo $argument | grep "," > /dev/null
|
||||||
then
|
then
|
||||||
algebraic_notation=0
|
|
||||||
move=$argument
|
move=$argument
|
||||||
else
|
else
|
||||||
file=$argument
|
file=$argument
|
||||||
|
@ -39,12 +33,10 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if [ $algebraic_notation -eq 0 ]
|
origin=$(echo $move | awk -F\- '{print $1}')
|
||||||
|
dest=$(echo $move | awk -F\- '{print $2}')
|
||||||
|
if grep $dest $file > /dev/null
|
||||||
then
|
then
|
||||||
origin=$(echo $move | awk -F\- '{print $1}')
|
|
||||||
dest=$(echo $move | awk -F\- '{print $2}')
|
|
||||||
if grep $dest $file > /dev/null
|
|
||||||
then
|
|
||||||
if [ $force -eq 1 ]
|
if [ $force -eq 1 ]
|
||||||
then
|
then
|
||||||
sed 's/'"$origin"'/'"$dest"'/' $file > $file.new
|
sed 's/'"$origin"'/'"$dest"'/' $file > $file.new
|
||||||
|
@ -53,8 +45,7 @@ then
|
||||||
sed 's/'"$dest"'/0,0/g' $file > $file.new
|
sed 's/'"$dest"'/0,0/g' $file > $file.new
|
||||||
sed 's/'"$origin"'/'"$dest"'/' $file.new > $file
|
sed 's/'"$origin"'/'"$dest"'/' $file.new > $file
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sed 's/'"$origin"'/'"$dest"'/' $file > $file.new
|
sed 's/'"$origin"'/'"$dest"'/' $file > $file.new
|
||||||
mv $file.new $file
|
mv $file.new $file
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
Reference in New Issue