Skip to content

Instantly share code, notes, and snippets.

@misteio
Created April 4, 2014 13:06
Show Gist options
  • Save misteio/9974369 to your computer and use it in GitHub Desktop.
Save misteio/9974369 to your computer and use it in GitHub Desktop.
cd /mydir
unlink current
ln -s releases/${BUILD_NUMBER} current
cd /var/www/html
unlink current
ln -s releases/${BUILD_NUMBER} current
num=${BUILD_NUMBER}
x=4
(( num -= x ))
echo $num
for dir in /mydir
do
dir=${dir%*/}
if [ "${dir##*/}" -lt "$num" ]; then
echo ${dir##*/}
rm -r $dir
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment