Last active
August 29, 2015 14:25
-
-
Save gavinwahl/a914384e79d7a3856bcc to your computer and use it in GitHub Desktop.
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
tmpd = do | |
tmp <- var $ glob "/tmp/tmp/" | |
today <- function $ cmd "date" ["+%F"] | |
when_ (not_ $ dirExists tmp) $ mkdir tmp | |
cd tmp | |
i <- var $ lit "1" | |
dir <- var $ today | |
while_ (dirExists dir) $ do | |
set i $ readVar i + 1 | |
set dir $ today <> lit "." <> readVar i | |
mkdir dir | |
cd dir |
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
_V0=/tmp/tmp/ | |
_F1() { | |
date "+%F" | |
} | |
if ! "$(test "-d" "$_V0")" | |
then | |
mkdir "$_V0" | |
fi | |
cd "$_V0" | |
_V2="1" | |
_V3="$(_F1)" | |
while test "-d" "$_V3" | |
do | |
_V2="$(expr "$_V2" "+" "1")" | |
_V3="$(_F1)"".""$_V2" | |
done | |
mkdir "$_V3" | |
cd "$_V3" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment