• Wincent
    Open
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search

Conditionals in BashEdit

Created 4/2/2015, updated 5/18/2017
  • [: alias for the test command, is POSIX and portable, supported by many shells
  • [[: a language keyword, supported by Bash/Zsh, additional features (eg. not necessary to quote variables etc)
  • if: naked if construct can be used to check if commands complete successfully (eg if ! some_command; then ...; fi)

See also

  • http://mywiki.wooledge.org/BashFAQ/031
  • bash
  • zsh
  • wiki
Site
  • About
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search
External
  • GitHub
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
Colophon

Made by Greg Hurrell using React, Relay and GraphQL (with help from Git, Redis and Neovim).