This repo contains some basics to advanced concepts of The Linux BASH. It also has some utility bash-scripts which can be used to make life easier.
Lets first discuss about the conventions of writting bash-scripts.
The very first line should be a shebang line (https://en.wikipedia.org/wiki/Shebang_(Unix)).
Followd by Auther Description, Data created , Date Modified , short description & usage. Like below :
After these lines , All the variables that have been used in the script should be declared.
Then the actuall script starts.
-
Bash variables are untyped. There is nothing like integer, string or bool variables in bash. You can imagine them as a bunch of characters stored in memory, with no special meaning. but, depending on context, Bash permits arithmetic operations and comparisons on variables. The determining factor is whether the value of a variable contains only digits.
-
It support arrays, which is a list of varibles.
-
List of scpecial characters : whitespaces like newLine, space, tab, carriagereturn etc. ' " \ $ # = [ ] { } ( ) ! < > | ; & ` * ? ~
-
use the below syntax for multiline commenting in bash:
: '
first line
second line
....
'
the space between the colon and singleQuote is important. -
To run script, you may have to give the execution permission, using command like ,
chmod 744 filename
basics
conditions
rules
loops