An “sbt new” shell script (that removes the project and target directories)

As a quick note, I wrote this little Unix/Linux shell script that I named sbtnew to run the sbt new command (with the template shown), and then delete the project and target directories that sbt new creates in my current directory:

#!/bin/sh

# sbtnew:  a script to run 'sbt new' and then clean up the project and target directories
# version: 0.1
# license: GNU GENERAL PUBLIC LICENSE, see https://choosealicense.com/licenses/gpl-3.0/#

# [1] create a new Scala 3 project
sbt new scala/scala3.g8

# [2] clean up the 'project' and 'target' directories
if [ -e project ]
then
    echo "i see project"
    rm -rf project
fi

if [ -e target ]
then
    echo "i see target"
    rm -rf target
fi

Please note that this project/target directory situation seems to be getting better with new versions of sbt, so this sbtnew shell script may not be needed in the future, but I still like it because it’s easier to remember than the full sbt new... command. One day I’ll also add the ability to rename the directory to what I entered, because for some reason sbt new changes the name to lowercase.