DarkWiiPlayer
4fef56cdb8
When passing any arguments to scratch, they will be executed as a command in the temporary directory
17 lines
271 B
Bash
Executable file
17 lines
271 B
Bash
Executable file
#!/bin/bash
|
|
export scratch=$(mktemp -p /dev/shm -d -t tmp.XXXXXXXXXX)
|
|
|
|
function finish {
|
|
rm -rf "$scratch"
|
|
}
|
|
|
|
trap finish EXIT
|
|
trap finish SIGTERM
|
|
|
|
if [ -z $1 ]
|
|
then
|
|
bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")
|
|
else
|
|
cd $scratch
|
|
"$@"
|
|
fi
|