Compare commits

..

2 commits

Author SHA1 Message Date
6d7ab08576 Засунул весь линк нейм в эчо 2023-07-14 20:56:51 +03:00
Hisumi
ce5b3688d5 test fix 2023-07-14 20:50:59 +03:00

View file

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