Created
August 19, 2020 02:37
-
-
Save Sidd-Dino/8c40de7ea0a87e858d78ce1880d08669 to your computer and use it in GitHub Desktop.
folder which deletes itself when you leave it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#This script was made on a request from one of my human | |
# friends. He needed a folder that would delete itself when | |
# leaves it. | |
# | |
# Press Ctrl+d to leave the folder and let it delete itself | |
#time used to creaate uniques folders | |
time=$(printf "%(%l%M%S)T\\n" "-1") | |
mkdir temp_folder_"$time" | |
__old_pwd__="$PWD" | |
cd temp_folder_"$time" && "$SHELL" | |
cd "$__old_pwd__" || exit | |
rm -rf "temp_folder_$time" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment