SWITCH-LINK(1) BSD General Commands Manual SWITCH-LINK(1)NAME
switch-link — retarget symlinks based on the extension of their targets
SYNOPSIS
switch-link [Nv] oldext newext
switch-link -h | -V
DESCRIPTION
The switch-link utility examines all the symlinks in the current direc‐
tory and its subdirectories, looking for those whose targets end in the
.oldext extension as specified on the command line. If any of those are
found, they are changed to point to a target with the same base name and
a .newext extension as specified on the command line. This is useful in
some setups when such symlinks are used to provide different images for
different situations, e.g. holiday decoration.
Options:
-h Display a usage message and exit.
-N No-operation mode; just display what would have been done.
-V Display program version information and exit.
-v Verbose operation; display diagnostic messages.
RETURN VALUES
The switch-link utility exits 0 on success, and >0 if an error occurs.
ENVIRONMENT
The switch-link utility's operation is currently not directly affected by
its environment.
FILES
The switch-link utility examines the current directory and all its subdi‐
rectories, and its operation is not further affected by any files.
EXAMPLES
Change all the symlinks pointing to *.nonch to point to the same file,
but with a .ch extension:
switch-link nonch ch
See what switch-link would do without actually changing any links:
switch-link -N nonch ch
SEE ALSOln(1)HISTORY
The switch-link utility was written by Peter Pentchev in 2010.
AUTHORS
Peter Penchev ⟨roam@ringlet.net⟩
TODO
* Create a temporary file containing the list of links to avoid
weird security-like issues or plain old incorrect operation
resulting from whitespace in the link's name.
BSD December 26, 2010 BSD