jerome schatten (romers@home.com)
Mon, 21 Feb 2000 10:22:26 -0800
Thanks for your help (all). I opted to do it a link at a time, deleting
the old, and putting in the new. I think I must wait 'til I understand
scripts with more facility before I try something like the one below
<g>.
jerome
Curt Sampson wrote:
>
> Well, it's not going to be terribly easy, since there's no non-kludgy
> way I know of to reliably get the target of a symlink in Unix. But
> the first line of this script does it, assuming you don't have any
> filenames with `->' in them, and the rest just links to the same
> filenames as the old targets, but in the current directory.
>
> ls -l | sed -n -e 's/.* \([^ ]*\) -> \(.*\)/\1 \2/p' |\
> while read link oldtarget; do
> newtarget=$(basename $oldtarget)
> echo ln -s $newtarget $link
> done
>
> Run this as it stands an examine the output carefully. If it looks
> as if it's ging to do what you want to do, remove the `echo' command
> in the fourth line, and it will actually execute the links.
>
> cjs
> --
> Curt Sampson <cjs@cynic.net> 917 532 4208 De gustibus, aut bene aut nihil.
> The most widely ported operating system in the world: http://www.netbsd.org
-- This message came to you via the Vancouver Linux Users Group mailing list. For unsubscription instructions do not email the list, but rather send mail to <vanlug-request@gweep.bc.ca>.
This archive was generated by hypermail 2.0b3 on Mon 21 Feb 2000 - 18:24:16