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.
This commit is contained in:
Talia 2018-11-06 14:36:31 +01:00
parent 8c13c8c3de
commit 6a8d978bfd

9
bin/scratch Executable file
View file

@ -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")