Skip to main content

Posts

Showing posts with the label Shell script

How to read user's input in Bash Script

Create shell script file as below: #!/bin/bash echo "Enter your name!" read name echo "Welcome to Mars $name" Make script file executable chmod u+x test.sh Run script sh test.sh Output of the script: Enter your name! Rectangle Welcome to Mars Rectangle

Install Ansible on Ubuntu using Shell Script

Shell Script to Install Ansible in Ubuntu #!/bin/bash echo "UPDATING ALL PACKAGES" sudo apt update -y for i in 1 2 3 4 5 do echo " " done echo "INSTALLING software-properties-common" sudo apt install software-properties-common -y for i in 1 2 3 4 5 do echo " " done echo "INSTALLING ppa:ansible/ansible REPOSITORY" sudo apt-add-repository --yes --update ppa:ansible/ansible -y for i in 1 2 3 4 5 do echo " " done echo "INSTALLING ANSIBLE" sudo apt install ansible -y Same script is also available at https://github.com/JaydeepUniverse/automation/blob/master/ansible.sh