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:
parent
8c13c8c3de
commit
6a8d978bfd
1 changed files with 9 additions and 0 deletions
9
bin/scratch
Executable file
9
bin/scratch
Executable 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")
|
Loading…
Reference in a new issue