Fix scratch bash script

This commit is contained in:
Talia 2019-09-18 14:31:20 +02:00
parent 89a191969f
commit fee1f0601a

View file

@ -1,9 +1,11 @@
#!/bin/bash #!/bin/bash
export scratch=$(mktemp -p /dev/shm -d -t tmp.XXXXXXXXXX) export scratch=$(mktemp -p /dev/shm -d -t tmp.XXXXXXXXXX)
function finish { function finish {
echo "Deleting $scratch..."
rm -rf "$scratch" rm -rf "$scratch"
} }
trap finish EXIT trap finish EXIT
trap finish TERM trap finish SIGTERM
exec bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")
bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")