Configure a static IP address on CentOS 7 / RHEL 7 URL :- How to configure a static IP address on CentOS 7 / RHEL 7 Path :- cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 BOOTPROTO=static IPADDR=192.168.1.150 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS=8.8.8.8 Path :- cat /etc/resolv.conf # Generated by NetworkManager ...
Introduction to the Bash Shell :- The Linux command line is provided by a program called the shell. File extension of .sh. ex:- example.sh #! /usr/bin/bash echo "Hello World" Provide execution rights to your user:- chmod u+x example.sh Run the script :- You can run the script in the following ways: ./example.sh How to define variables We can define a variable by using the syntax variable_name=value . To get the value of the variable, add $ before the variable. #!/usr/bin/bash # A simple variable example greeting=Hello name=Tux echo $greeting $name How to read user input #!/usr/bin/bash echo "Enter a numner" read a echo "Enter a numner" read b var = $(( a + b )) echo $var
Comments
Post a Comment