From 64ec9f23047545432f759e543184b4271e3aad22 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Sat, 9 Mar 2019 21:04:29 -0500 Subject: [PATCH] Add experiment script --- bin/experiment | 21 +++++++++++++++++++++ lib/login_functions.sh | 4 ++++ 2 files changed, 25 insertions(+) create mode 100755 bin/experiment diff --git a/bin/experiment b/bin/experiment new file mode 100755 index 0000000..3a40a51 --- /dev/null +++ b/bin/experiment @@ -0,0 +1,21 @@ +#! /bin/sh + +set -e; + +name="$1"; + +if [ "$name" != "" ]; +then + timestamp=`date +'%F--%H-%M--%S'`; + directory="$HOME/Experiments/$timestamp--$name"; + mkdir -p "$directory"; + cd "$directory"; + echo "# $name\n" > README.md; + git init >&2 + git add . >&2 + git commit -m 'Initial commit' >&2 + echo "$directory"; +else + echo "Please give the experiment a name, as the first argument."; + exit 1; +fi; diff --git a/lib/login_functions.sh b/lib/login_functions.sh index f0963b7..c67de2e 100644 --- a/lib/login_functions.sh +++ b/lib/login_functions.sh @@ -32,3 +32,7 @@ man() { LESS_TERMCAP_us=$'\e[01;32m' \ command man "$@" } + +experiment() { + cd "$($HOME/bin/experiment $@)" +} -- 2.20.1