Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky RichardBronosky/local-bin
Last active Nov 14, 2019

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.