This is story about developer who start in old PHP world where we use mixed php+html+inline css and deploy to shared hosting via FTP (All GUI). Using rename folder for versioning. Once enter terminal and don’t know what was that black screen, and when accidentally edit file with vim and end up by restarting computer. That’s the time where i was living.
Now, i’m accidentally a backend human who always in front of black screen monitor, either its learning something, code a script or just watch and filter logs (mostly still manual).
How Bash Script Help Me
I still don’t know much about it but at least this one language could help me in my productivity. Bash have its own way in its syntax. and its literally execute cli command like if you have to start many service to start a project you could just create bash script and run it once.
this is example for
sudo service php7.0-fpm start
sudo service mysql-server start
sudo service nginx start
and combine it with alias to your
alias lemp="sh ~/.startlemp.sh"
now you could open computer in the morning little youtube for a while and when you want to start your project just open terminal and type :
For someone that have huge WPM will have no problem with type all of that in second, or someone with high end computer will make those lemp stack in startup so they will alive when computer start. But for someone with little WPM, lazy, and don’t have great spec in computer will really helped by bash script.
don’t compare with docker. Its about the bash 😀 and back there docker is not hype yet.
Bash help me enter SSH with the flag
how to create variable with bash? you could use :
var1="is var one"
and now i want to type
ss back will go to my backend server without type the ip over and over, I will use something like this file
if [ "$1" = "back" ]; then
elif [ "$1" = "front" ]; then
echo "server side required"
echo "will execute"
echo "ssh $server"
and once gain combine it with alias.
alias ss="sh ~/
now for running that script just type :
ss back to ssh to backend server.
ss front to ssh to front end server.
To be able to ssh to server i want with just two word was awesome. Up until now bash and aliases help me a lot. hope this article, bash, and aliases will help you too.