Skip to content

Instantly share code, notes, and snippets.

@shirohana
Last active April 5, 2017 18:27
Show Gist options
  • Save shirohana/c82a329a27a4433e75f4d7273ee68fc8 to your computer and use it in GitHub Desktop.
Save shirohana/c82a329a27a4433e75f4d7273ee68fc8 to your computer and use it in GitHub Desktop.
Simple shell script to drop the specified yarn cache
#!/bin/bash
REMOVE_DIRS=$(ls -d $(yarn cache dir)/* | grep $@)
if [ -z REMOVE_DIRS ]; then
echo Empty
else
for dir in $REMOVE_DIRS; do
read -p "rm -rf $dir? " -n 1 -r
echo # Present a newline
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf $dir
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment