Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save githubutilities/cc078b21440df7a30cb4 to your computer and use it in GitHub Desktop.

Select an option

Save githubutilities/cc078b21440df7a30cb4 to your computer and use it in GitHub Desktop.
Bash CheatSheet

Bash CheatSheet

test command in unix

test is used to test things like testing if file existed or a comparison expression.

Note: [(bracket) is a program in POSIX compatible shell and should be surrounded by blank space.

IFS Expansion

Conditional expression

[ is a synonym for test command while [[ is a improved version of it which allows usage of || internally.

Allow white spaces in bash variable

SUPPORT=~/Library/"Application Support"
cd "${SUPPORT}"

Replacing cd with z

brew install z

# add the following line to .bash_profile
. `brew --prefix`/etc/profile.d/z.sh

Comparison between bash and zsh

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