#!/bin/bash -f mode=755 files= target= here=`pwd` while [ "$#" != 0 ]; do case "$1" in -m) mode="$2" shift ;; *) if [ "$#" = 1 ]; then target="$1" done=yes else case $1 in /*) files="$files $1" ;; *) files="$files $here/$1" ;; esac fi shift ;; esac done #echo files = $files #echo target = $target if [ -d "$target" ]; then for f in $files; do rm -f "$target"/`basename $f` (cd $target >/dev/null && ln -v -s $f .) done else rm -f $target ln -v -s $files $target fi