Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkaneko/76ce150572eff89681e7 to your computer and use it in GitHub Desktop.
Save rkaneko/76ce150572eff89681e7 to your computer and use it in GitHub Desktop.
Basis of Shell script.
#!/bin/bash
cat <<_EOT_
# executing script name. Naming starting point is directory which call this scrip.
$0: $0
# parent directory of executing script.
`dirname $0`: `dirname $0`
# name of executing script.
${0##*/}: ${0##*/}
# name of executing script.
`basename $0`: `basename $0`
# the number of args you gave execution script.
\$#: $#
# all values of args you gave executing script.
\$*: $*
# flag if excuted just before command is succeed or not.
\$?: $?
_EOT_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment