Skip to content

Instantly share code, notes, and snippets.

@7rin0
Last active June 28, 2018 15:19
Embed
What would you like to do?
Shell > Keep the last 3 revisions
# oneline
RELEASE_NB=$(ls -tdr -- */ | cut -d'/' -f1 | wc -w) && RELEASE_NB_DIFF=$(echo $RELEASE_NB-3 | bc) && if test $RELEASE_NB > 3 ; then rm -rf $(ls -tdr -- */ | head -$RELEASE_NB_DIFF | cut -d'/' -f1) ; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment