Class Not
Class Not
Class Not
https://linuxconfig.org/bash-scripting-tutorial-for-beginners
-----------------------------------------------
To start with bash script you should know how the bash script start
to define the script interpreter enter the prefix with path of bash as show down
`#!/bin/bash`
A very simple program to print hello world as all in other programing language
```
#!/bin/bash
echo "hello world !"
```
echo behave as print in bash
~>make it executable with the chmod cmd and then run it.
```
chmod +x filename.sh
./filename.sh
```
#VARIABLES
```
#!/bin/bash
greeting="Welcome"
user=$(whoami)
day=$(date +%A)
echo "$greeting back $user! Today is $day, which is the best day of the entire
week!"
First, we have declared a variable greeting and assigned a string value Welcome to
it. The next variable user contains a value of user name running a shell session.
This is done through a technique called command substitution. Meaning that the
output of the whoami command will be directly assigned to the user variable. The
same goes for our next variable day which holds a name of today's day produced by
date +%A command.
The second part of the script utilises the echo command to print a message while
substituting variable names now prefixed by $ sign with their relevant values. In
case you wonder about the last variable used $BASH_VERSION know that this is a so
called **internal variable** defined as part of your shell.
-------------------------------------------------
# Quick Tip:
Never name your private variables using UPPERCASE characters. This is because
uppercase variable names are reserved for internal shell variables, and you run a
risk of overwriting them. This may lead to the dysfunctional or misbehaving script
execution.
===========
=================================
================================================
${parameter}
#FUNCTION