From 6a8d978bfdcbe737eedc2496daef26ef63a755b4 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 6 Nov 2018 14:36:31 +0100 Subject: [PATCH] Add scratch script This script creates a new temporary folder and starts a bash shell in it. After the shell exits, the directory is deleted. --- bin/scratch | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bin/scratch diff --git a/bin/scratch b/bin/scratch new file mode 100755 index 0000000..567027b --- /dev/null +++ b/bin/scratch @@ -0,0 +1,9 @@ +#!/bin/bash +export scratch=$(mktemp -d -t tmp.XXXXXXXXXX) +function finish { + echo "Deleting $scratch..." + rm -rf "$scratch" +} +trap finish EXIT +trap finish TERM +bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")