commit e21b32c7a04403932b88896b22775d0fbdfd71ac
parent 047a5cfbd8f2032a8da6c5cca6e7692d43a6eee3
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 23 Dec 2023 16:07:26 +0100
fix
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/wikimv b/wikimv
@@ -5,7 +5,7 @@ TO="$2"
FROMF="$HOME/todo/wiki/$FROM"
TOF="$HOME/todo/wiki/$TO"
-if [ -f $TOF ]
+if [ -f "$TOF" ]
then
echo 'target already exists'
exit 42
@@ -16,9 +16,10 @@ mv "$FROMF" "$TOF" || (echo 'fail move'; exit 42)
# now replace all links in files with match
cd "$HOME/todo/wiki"
-grep -RlF "[$a]" | while read a; do
+grep -RlF "[$FROM]" | while read a; do
if [ -f $a ]; then
sed -i "s/\[$FROM\]/\[$TO\]/g" $a
fi
done
+exit 0