|
| 1 | +## 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. |
| 2 | +<br /> |
| 3 | + |
| 4 | +# Conventions :: |
| 5 | + |
| 6 | +Lets first discuss about the conventions of writting bash-scripts. |
| 7 | + |
| 8 | +The very first line should be a shebang line (https://en.wikipedia.org/wiki/Shebang_(Unix)). |
| 9 | + |
| 10 | +## #!/bin/bash |
| 11 | + |
| 12 | +Followd by Auther Description, Data created , Date Modified , short description & usage. Like below : |
| 13 | + |
| 14 | +## #AUTHOR : Arnob kumar saha |
| 15 | +## #Date Created : 06-11-2021 |
| 16 | +## #Last Modified : 10-12-2021 |
| 17 | + |
| 18 | +## #DESCRIPTION : write a one-liner comment to express the overall functionality of this script. |
| 19 | +## #USAGE : How to use this script |
| 20 | + |
| 21 | +After these lines , All the variables that have been used in the script should be declared. |
| 22 | + |
| 23 | +## age=23 |
| 24 | +## x=something |
| 25 | + |
| 26 | +Then the actuall script starts. |
| 27 | + |
| 28 | +# You should know :: |
| 29 | + |
| 30 | +1) Bash variables are untyped. |
| 31 | +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. |
| 32 | + |
| 33 | +2) It support arrays, which is a list of varibles. |
| 34 | + |
| 35 | +3) List of scpecial characters : |
| 36 | +whitespaces like newLine, space, tab, carriagereturn etc. |
| 37 | +' " \ $ # = [ ] { } ( ) ! < > | ; & ` * ? ~ |
| 38 | + |
| 39 | +4) use the below syntax for multiline commenting in bash: <br /> |
| 40 | +: ' <br /> |
| 41 | + first line <br /> |
| 42 | + second line <br /> |
| 43 | + .... <br /> |
| 44 | +' <br /> |
| 45 | +the space between the colon and singleQuote is important. |
| 46 | + |
| 47 | +5) To run script, you may have to give the execution permission, using command like , <br /> |
| 48 | +chmod 744 filename |
| 49 | + |
| 50 | +<br> |
| 51 | + |
| 52 | +# Contents (in serial order) :: |
| 53 | +[basics](https://github.com/ArnobKumarSaha/bashscripting/tree/main/basics) <br> |
| 54 | +conditions <br> |
| 55 | +rules <br> |
| 56 | +loops <br> |
| 57 | + |
| 58 | + |
0 commit comments