I want to create symlinks to multiple files:
ln -s dev-*.php 's/dev-(.*\.php)/$1/'
Results hoped for:
site.php links to dev-site.php
file.php links to dev-file.php
What's the most concise way to achieve this?
|
|
|
Well, if it's all in the same directory you could do something like this in bash or any other Bourne-style/POSIX shell:
which would create symlinks without "dev-" to files beginning with "dev-". |
|||||||||||
|
|
I usually use a brief one-liner.
This cycles through the 'dev-*.php' files, getting the new name without 'dev-', then creating the symlink. |
|||
|
|
|
With
With
Note that if |
|||
|
|