Skip to content

Instantly share code, notes, and snippets.

@kaiwan
Last active December 6, 2018 13:50
Show Gist options
  • Save kaiwan/252888cfee0ba13408767e592177fcc7 to your computer and use it in GitHub Desktop.
Save kaiwan/252888cfee0ba13408767e592177fcc7 to your computer and use it in GitHub Desktop.
Useful CLI stuff
--------------------------------------------
To get timestamp in a useful format:
date +%a_%d_%m_%Y_%H%M
Eg. o/p:
$ date +%a_%d_%m_%Y_%H%M
Thu_06_12_2018_0737
$
--------------------------------------------
Shell scripting:
To have a cleanup function run on (ab)normal exit:
trap clean_on_exit EXIT
trap "exit 1" INT TERM # makes the EXIT trap effective even when killed
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment