Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active November 14, 2019 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/cd915bf9221f3e990ead48e5505f5733 to your computer and use it in GitHub Desktop.
Save RichardBronosky/cd915bf9221f3e990ead48e5505f5733 to your computer and use it in GitHub Desktop.
#!/bin/bash -eu
[[ -z ${1:-} ]] && \
echo -e "\n""Usage: $0 executable_path [destination_path] ""\n" || \
executable_path="${1:-}"
: $executable_path
destination_path="${2:-/usr/local/bin}"
exec="$( basename $executable_path )"
dir="$( dirname $executable_path )"
[[ -n $dir ]] && cd $dir
chmod +x "$exec"
ln -s "$PWD/$exec" "$destination_path"

local-bin

A simple script for symlinking a script to /usr/local/bin

It's intended for scripts that are in git repos in your dev directory. Symbolic linking them to /usr/local/bin (or some other location in your $PATH) allows you to always have the most up to date version available to run and encourages you to share the tools you write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment