Skip to content

Instantly share code, notes, and snippets.

@tobalsan
Created July 29, 2014 11:30
Show Gist options
  • Save tobalsan/234f6613553d5af440ae to your computer and use it in GitHub Desktop.
Save tobalsan/234f6613553d5af440ae to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Please provide at least SOURCE and PATH LINK"
else
# By default (if no arguments passed) we create a junction in Winwdows
if [ "$1" == "-j" ] || [ "$1" != '-s' ]; then
case $1 in
"-j")
if [ -z "$3" ]; then
echo "No TARGET specified"
exit 1
else
src=$2
tgt=$3
fi;;
*)
src=$1
tgt=$2;;
esac
if [ ! -d "$src" ]; then
echo "SOURCE is not a directory"
else
ln-win --junction "$tgt" "$src"
exit
fi
elif [ $1 == "-s" ]; then
if [ -z "$3" ]; then
echo "No TARGET specified"
exit 1
else
src=$2
tgt=$3
fi
if [ ! -d "$src" ]; then
echo "SOURCE is not a directory"
else
ln-win --symbolic $src $tgt
exit
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment