Bash stands for Bourne Again Shell because it is an improvement on the previously existing shell. This blog post is to understand the whole concept of bash and get why developers really use bash! This is just the beginning so it will cover the basics.
Bash is used on linux OS. I will be using Mac OS in this. blog post the default shell is zsh. To use bash installed some dependencies to get started.
Bash can be used for virtual machines, deploying services and automating basic tasks.
Open terminal and type the following commands to change your file directory and move from zsh to bash.
To access bash terminal, type these commands. Notice the change to bash.
Create a new file as .sh file for scripting.
Use "nano" to open the script in terminal and start typing bash script.
Every bash script should begin with this code below known as "Shebang".
Now type the bash script.
!# /bin/bash echo "Good morning Karece!"
Select Ctrl + x on your keyboard then select "y" also on your keyboard, then enter to save the script.
Check permissions. And make your script executable.
Now run your bash script using.
That's the first bash script!
Another bash script you can try.
#!/bin/bash name=$1 compliment= $2 user=$(whoami) whereami=$(pwd) date=$(date) echo "Good morning $name!!" sleep 1 echo "You're looking good today $name!" sleep 1 echo "You have the best $2 ever $name!" sleep 2 echo "You are currently logged in as $user and you are in the directory $whereami. Also today is: $date"
./nameofscript Karece Code
Some helpful videos can be found here