Skip to content

Instantly share code, notes, and snippets.

@AlexAtkinson
Last active August 24, 2022 16:41
Show Gist options
  • Save AlexAtkinson/02df7249a78073309dbc66aac3d28cc5 to your computer and use it in GitHub Desktop.
Save AlexAtkinson/02df7249a78073309dbc66aac3d28cc5 to your computer and use it in GitHub Desktop.
ProTip: RC File Dependency Sanities
# Include simple dependnecy checks for aliases.
# Set aliases only if dependnecy is available.
# An IF statement may makes more sense...
dep='xclip'
[[ ! $(command -v $dep) ]] && echo -e "\e[01;31mERROR:\e[0m ${BASH_SOURCE[0]} - $dep not available!"
[[ $(command -v $dep) ]] && alias clipc="xclip -selection c"
[[ $(command -v $dep) ]] && alias clipp="xclip -selection c -o"
[[ $(command -v $dep) ]] && alias clipv="clipp | less"
# Note: you could also name these aliases pbcopy/pbpaste, if that suits you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment