Skip to content

Instantly share code, notes, and snippets.

@trambopoline
Last active September 15, 2018 18:10
Show Gist options
  • Select an option

  • Save trambopoline/5aa4f52bf8dc13b8abcd5c6abf56a6e6 to your computer and use it in GitHub Desktop.

Select an option

Save trambopoline/5aa4f52bf8dc13b8abcd5c6abf56a6e6 to your computer and use it in GitHub Desktop.
A cross-platform .bashrc file that can be placed in a shared location ( Google Drive, Dropbox, etc... ) and loaded from the primary .bashrc. Thanks to https://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux/17072017#17072017 for the cross-platform logic.
# To include this file's content in your shell:
# Put the commented out chunk below in your primary .bashrc ( usually located at ~/.bashrc ) and ensure it points to this file
# include shared .bashrc if it exists
# if [ -f ~/path/to/shared.bashrc ]; then
# . ~/path/to/shared.bashrc
# else
# echo "Error: Could not find shared bash file."
# fi
###########################
# Platform-agnostic stuff #
###########################
# You can place cross-platform aliases/exports/scripts/whatever here
# ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
###########################
# Platform-specific stuff #
###########################
if [ "$(uname)" == "Darwin" ]; then
# Mac OS X
:
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# Linux
:
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
# 32 bit Windows NT
:
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
# 64 bit Windows NT
:
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment