blob: a3db6ae28b825ca332bac9e5784c4d78d6a8715f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/bin/bash
sed -e '/^\s*$/d' -e '/#/d' symlinks | while read _path _link; do
path="$(sed -rn 's|[^/]+/|../|g;s|/[^/]+$|/|p' <<<"$_link")${_path}"
link="$HOME/$_link"
if [[ -L "$link" ]]; then
rm -f "$link"
fi
if [[ -e "$link" ]]; then
echo "ERROR: file exists: $link" >> /dev/stderr
else
mkdir -p "${link%/*}"
ln -s "$path" "$link"
fi
done
|