DEV Community

Discussion on: One bash command to start the day 🌅

Collapse
 
bogdaaamn profile image
Bogdan Covrig

Great post and idea! I recently got into shell scripts as well trying to automate some stuff.

Not yet ready to share the full code because is quite trashy 👀 but this is a little snippet making, changing, and opening a directory in code for a fresh new project.

# MKDIR with the inputted name. If already exists, just ignore, continue anyways      
tput setaf 0; echo -n "Creating directory... "
mkdir $flpath 
tput setaf 2; echo "done."

# CD to the inputted folder
tput setaf 0; echo -n "Changing directory... "
cd $flpath 
tput setaf 2; echo "done."

# OPEN CODE from the folder
tput setaf 0; echo -n "Opening VS Code... "
code -n . 
tput setaf 2; echo "done."

Really loved finding out about tput setaf changing the color of the text in the terminal, it makes it look cooler.

Terminal new command

Also nice trick source ~/.new-sh-script.sh in the zsh config file and it loads the new (or any other function) in the terminal as a command.

Collapse
 
dmahely profile image
Doaa Mahely • Edited

This is really cool! That's gonna be a very useful script. I look forward to seeing the final result 😄