Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove derived data with shell script

I'm trying to create a sh to remove the contents of Xcode's deriveddate folder. I wrote this, it goes to the desired folder, and list the content, but when I remove the # and try to delete it, than it says

"**line 1: =~/Library/Developer/Xcode/DerivedData/: No such file or directory
Desktop     Downloads   Movies      Pictures    clitools.dmg
Documents   Library     Music       Public
override r--r--r--  dajkaferenc/staff for Desktop/Christmas Game update/.git/objects/00/8b8026f772525ccff6c3361ecc6f3eb43d0d82?** "



$DIR="~/Library/Developer/Xcode/DerivedData/"
cd $DIR
ls
#rm -r -- "$DIR"*
like image 366
Ferenc Dajka Avatar asked Jan 12 '23 08:01

Ferenc Dajka


1 Answers

  • You cannot place ~ inside the quotes. Shell doesn't expand that.
  • Variable assignment doesn't have $ before the variable name.

Try this:

DIR=~/Library/Developer/Xcode/DerivedData/
cd $DIR
ls
rm -r -- "$DIR"*
like image 87
anubhava Avatar answered Jan 17 '23 23:01

anubhava