Code templates are handy and help in finishing codes without error.
I am aware that notepad editors like atom provide code templates for if and for loop for bash.
Also aware that man pages provide assistance in understanding the syntax. For e.g., man $SHELL helps to understand the if and for commands.
But, I was wondering if there is a way to bring code templates into a terminal itself rather than using a code editor? This will help us to be more productive.
Let me give a use case scenario.
For this post to be solved, I wanted to have a for loop and then a if loop encased in that.
So if a template for for loop can be generated by some shortcuts in the terminal such that
for i in **type words here**; do
**type words here**
done
Then I go inside the for loop template and then click another shortcut for the ```if````
for i in **type words here**; do
if [ **type words here**]; then
**type words here**
fi
done