8 lnto - Convenience wrapper for ln(1). User enters link target paths relative to the current directory
18 type relpath
>/dev
/null
22 declare -a link_targets
=()
27 local filedir
=`dirname "$file"`
28 local basename=`basename "$file"`
29 local relative_path
=`relpath "$filedir" "$target_dir"`"$basename"
30 link_targets
+=("$relative_path")
38 echo "Usage: $(basename "$0") [OPTIONS] <TARGET_DIR> [LINK_TARGET [LINK_TARGET [...]]]"
39 echo "Creates links (symlinks with -s) in TARGET_DIR which are pointing to LINK_TARGET."
40 echo "Unlike to ln(1), LINK_TARGET is relative to the current working directory, not to TARGET_DIR."
41 echo "OPTIONS are the same as for ln(1)."
46 *) if [ -z "$target_dir" ]
58 add_link_target
"$file"
61 ln "${opts[@]}" -t "$target_dir" "${link_targets[@]}"