Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/bash
#getting user input for name
name=${1}
namecap="$(tr '[:lower:]' '[:upper:]' <<< ${name:0:1})${name:1}"
#making sure user provided a name
if [ $# -eq 0 ]
then
printf "Please provide a name for your new application\ne.g. ./createapp.sh sensorapp\n"
exit
fi
#downloading switch example to use as base for application
echo Creating new application: $name
git clone https://github.com/CreatorDev/w1-switchcounter.git $name
#renaming files and folders
mv $name/Switch $name/$namecap
mv $name/$namecap/switch.c $name/$namecap/$name.c
#configuring makefile
sed -i "s/switch/$name/g" $name/$namecap/Makefile $name/Makefile
sed -i "s/Switch/$namecap/g" $name/Makefile
#adding new application to feed
cd ../creator-sdk
./scripts/feeds update -a && ./scripts/feeds install -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment