5
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v122 -> /home/files/video122
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v123 -> /home/files/video123
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v124 -> /home/files/video124
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v125 -> /home/files/video125
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v126 -> /home/files/video126
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v127 -> /home/files/video127
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v128 -> /home/files/video128
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v129 -> /home/files/video129
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v130 -> /home/files/video130
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v131 -> /home/files/video131
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v132 -> /home/files/video132
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v133 -> /home/files/video133
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v134 -> /home/files/video134
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v135 -> /home/files/video135
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v136 -> /home/files/video136
lrwxrwxrwx  1 deploy users    20  1월 23 18:15 v137 -> /home/files/video137

These are symbolic links.
If new video138 ~ video150 volumes are mounted, I have to make links v138~v150 of that.
Could you imagine a bash magic? (I tried to use brace expansion but couldn't make it work.)
It would be much better if the magic script can create the symlinks automatically, with detecting the volumes' mount.

2 Answers 2

9

Try a simple for loop

for Num in {138..150}; do
  ln -s "/home/files/video$Num" "v$Num"
done
4

With zsh:

autoload zmv
alias zln='zmv -L'
zln -s '/home/files/video(*)' 'v$1'

or

zln -s '/home/files/video(<138-150>)' 'v$1'

Otherwise, with zsh or recent versions of bash or ksh93 supporting {x..y}, you could do:

vln() for i do
  ln -s "/home/files/video$i" "v$i"
done

vln {138..150}
2
  • Is this working with bash? Commented Jan 23, 2013 at 10:22
  • @StephaneChazelas Oh right, I read too fast and completely missed the second part, sorry. Commented Jan 23, 2013 at 22:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.