теперь обрабатывает релативы

This commit is contained in:
bogdan zažigin 2023-07-14 23:09:33 +03:00
parent bd9302eb2f
commit 53e5df3efa

View file

@ -1,20 +1,21 @@
# create symbolic links
# by vim-like modelines
# of all files in the directory
# pootential arguments:
# directory=$1
# options=$2
# arguments
directory=$1
# options for linking with "ln"
options="-sfvnr"
# link modeline regular expression
# regular expression of link-modeline
regex="^.{2,3}link: \K\S+"
files=(`grep -rPHl "${regex}"`)
destinations=(`grep -rPho "${regex}"`)
files=($(grep -rPHl "${regex}"))
destinations=($(grep -rPho "${regex}"))
for ((e = 0; e <= (${#files[@]} - 1); e++));
# linking
for e in ${!files[@]};
do
target=${files[$e]}
link_name=${destinations[$e]}
ln -sfvnr $target $link_name
target=(${files[$e]})
link_name=(${destinations[$e]})
ln $options $target $link_name
done