Skip to content

Instantly share code, notes, and snippets.

@jcrashkit
Last active February 28, 2020 21:36
Show Gist options
  • Save jcrashkit/55dc2c847f376ea5c0dfd32b9f00c00c to your computer and use it in GitHub Desktop.
Save jcrashkit/55dc2c847f376ea5c0dfd32b9f00c00c to your computer and use it in GitHub Desktop.
WS=$HOME/Workspace
rebase() {
target=$1
if [ -z "$target" ]
then
exit 0
fi
domain=`echo $target | sed -e 's|^[^/]*//||' -e 's|/.*$||'`
if [ -d $WS/targets ]; then
mkdir $WS/targets/$domain
echo -e "\e[32mFound\e[0m targets directory, creating $domain working dir"
else
echo -e "\n\n\e[31mUnfound working dir.\n\e[0mCouldn't continue\n\n Creating..."
mkdir $WS/targets && mkdir $WS/targets/$domain
fi
return 0
}
rebase $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment