Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.6: Create Symbolic Links via Services' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Create Symbolic Links via Services
Authored by: PatrickS on Aug 18, '10 01:50:18AM
Great tip, thanks.

A slightly nicer and more shell-like version of the script could look like this:

fileSuffix=".link"
for f in "$@"; do
    while [ -e "$f$fileSuffix${fileNumer:+.$fileNumer}" ]; do
        let fileNumer+=1
    done

    echo "$f$fileSuffix${fileNumer:+.$fileNumer}"
    ln -s "$f" "$f$fileSuffix${fileNumer:+.$fileNumer}"
    fileNumber=
done


[ Reply to This | # ]