Bash is a Coding Language Installed for Mac/Linux. You can run it on it's Terminal. So let's get started.
Installing Homebrew
Now we need to install Homebrew to install packages/apps just by typing. I'm sure Homebrew is available already on Linux.
- Go to https://brew.sh
- Copy it's code
- Paste the copied code or type
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
in the Terminal. - Enter the password if prompted. The password feedback or the dots will not show up. Just keep typing the password if the dots didn't appear. Don't think it's broken.
- Press enter
- If it asks you to install the Xcode command line tools, install it in the software update or via the prompt itself.
- Wait for it to finish.
Installing Packages or apps with Homebrew
On Mac, type
For example:
brew install <package or app name>
For example:
brew install gh
to install the GitHub command.On Linux type
sudo apt-get install <package name>
For more info, go here.Finally, Bash
- Create a file called
main.sh
. - Type
echo "Hello World"
for the first code. - Save the file
- Type
chmod +x main.sh
or else it will show an error. - Type
./main.sh
to run it.
Here is a complete code I make
echo "What's the password????"
read -sp 'Password: ' passvar
echo
echo "Your password is: $passvar"
sleep 1
echo "Hello World!"
sleep 2
echo "What's your name?"
read -p 'Name: ' namevar
sleep 2
echo "You POV"
cowsay "Hello! I'm $namevar"
sleep 1
echo "Hello $namevar!"
sleep 2
echo "What do you want to tell about $namevar?"
read -p 'Type: ' textvar
sleep 1
echo "You POV"
cowsay $textvar
sleep 2
echo "Goodbye $namevar!"
sleep 1
echo "Goodbye World!"
sleep 2
echo "press ^C or terminate this process to exit."
sleep 100
while (true) do
echo "A FATAL error has occured! please press ^C right now!!!!!!!!!!!!"
echo "This error has occureed because you've waited too long!!!"
done; exit;
No comments:
Post a Comment