Skip to content

Instantly share code, notes, and snippets.

@ypetya
Created September 29, 2013 13:11
Show Gist options
  • Save ypetya/6752401 to your computer and use it in GitHub Desktop.
Save ypetya/6752401 to your computer and use it in GitHub Desktop.
Created this 'ln' function into my .bashrc, it emulates a 'cp' call instead of the real 'ln -s' which is not supported on windows MinGw.
function ln() {
echo "WARNING! 'ln' is an unsupported command on this platform."
echo " * The following command was called:"
echo "ln $@"
if [ $1 = "-s" ] ; then
echo " * Trying to translate it to a simple copy command : "
COMMAND="cp -R $2 $3"
echo "$COMMAND"
if [ -d $3 ] ; then
echo "Destenation directory already exists! command may fail!"
fi
echo "Continue? Y/n"
read "CONTINUE"
if [ $CONTINUE = "n" ] ; then
echo "Returning with code : 1"
return 1
fi
$COMMAND
return $?
else
echo "Only -s option is supported"
echo "Returning with code : 1"
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment