теперь обрабатывает релативы
This commit is contained in:
parent
bd9302eb2f
commit
53e5df3efa
1 changed files with 13 additions and 12 deletions
|
@ -1,20 +1,21 @@
|
||||||
# create symbolic links
|
# pootential arguments:
|
||||||
# by vim-like modelines
|
# directory=$1
|
||||||
# of all files in the directory
|
# options=$2
|
||||||
|
|
||||||
|
|
||||||
# arguments
|
# options for linking with "ln"
|
||||||
directory=$1
|
options="-sfvnr"
|
||||||
|
|
||||||
# link modeline regular expression
|
# regular expression of link-modeline
|
||||||
regex="^.{2,3}link: \K\S+"
|
regex="^.{2,3}link: \K\S+"
|
||||||
|
|
||||||
files=(`grep -rPHl "${regex}"`)
|
files=($(grep -rPHl "${regex}"))
|
||||||
destinations=(`grep -rPho "${regex}"`)
|
destinations=($(grep -rPho "${regex}"))
|
||||||
|
|
||||||
for ((e = 0; e <= (${#files[@]} - 1); e++));
|
# linking
|
||||||
|
for e in ${!files[@]};
|
||||||
do
|
do
|
||||||
target=${files[$e]}
|
target=(${files[$e]})
|
||||||
link_name=${destinations[$e]}
|
link_name=(${destinations[$e]})
|
||||||
ln -sfvnr $target $link_name
|
ln $options $target $link_name
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue