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
1 changed files with 9 additions and 0 deletions

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