Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
6d7ab08576 | |||
|
ce5b3688d5 |
1 changed files with 12 additions and 13 deletions
|
@ -1,21 +1,20 @@
|
||||||
# pootential arguments:
|
# create symbolic links
|
||||||
# directory=$1
|
# by vim-like modelines
|
||||||
# options=$2
|
# of all files in the directory
|
||||||
|
|
||||||
|
|
||||||
# options for linking with "ln"
|
# arguments
|
||||||
options="-sfvnr"
|
directory=$1
|
||||||
|
|
||||||
# regular expression of link-modeline
|
# link modeline regular expression
|
||||||
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}"`)
|
||||||
|
|
||||||
# linking
|
for ((e = 0; e <= (${#files[@]} - 1); e++));
|
||||||
for e in ${!files[@]};
|
|
||||||
do
|
do
|
||||||
target=(${files[$e]})
|
target=${files[$e]}
|
||||||
link_name=(${destinations[$e]})
|
link_name=${destinations[$e]}
|
||||||
ln $options $target $link_name
|
ln -sfvnr $target $(echo $link_name)
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue