Skip to content

Instantly share code, notes, and snippets.

@jyek
Last active August 29, 2015 13:57
Show Gist options
  • Save jyek/9693185 to your computer and use it in GitHub Desktop.
Save jyek/9693185 to your computer and use it in GitHub Desktop.

Bash Script Syntax

Scripts Should Start With Shebang
#!/bin/sh
Arguments

Arguments passed when the script is called from the command line are:

$0: script name
$1: first argument
$2: second argument
...
${10}: tenth argument
...
Variables
MYVAR=0
echo "$MYVAR" 
If Statements
if [ "$?" == "0" ]; then
  echo -n "."
else
  echo -n ".."
fi
References

http://www.zugiart.com/wiki/bash/

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