Do you have pesky repetitive tasks that eat up your time? Linux might just be able to help. How? You might ask. Using Linux’s Bash scripting, one can have a simple script up and running in a few minutes. Unlike using python or similar programming languages, you don’t have to use special syntax or strange commands.
To demonstrate the power of bash, lets automate something most of do that is repetitive. Pushing to git.
Here is how Bash Scripting works. Place the commands in the order that you would like them to execute. Sounds complicated right?
Lets test that out. Open up text file and name it (filename).sh. On the first line, we have what is called the shebang line. This line tells linux how to run the code (the path to the bash interpreter):
On the next three lines we have the three git commands that are required to push chnages.
git add * git commit git push
Once you add those lines, all you have left to do is make it an executable and run it!
This command allows you to execute the script as a program. Type this into your bash shell:
Congrats! All that is left is executing it.
It should open nano, where you type in your commit msg, save the document, and thats it.