теперь обрабатывает релативы
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
|
||||
# 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
|
||||
|
|
Loading…
Add table
Reference in a new issue