Bash-scripting-Cheat-Sheet-by-linuxsimply
Bash-scripting-Cheat-Sheet-by-linuxsimply
Cheat Sheet
Prepared By: Md Zahidul Islam Laku Copyright ©2023 linuxsimply.com| All rights reserved.
Bash Script
Cheat Sheet
Prepared By: Md Zahidul Islam Laku Copyright ©2023 linuxsimply.com| All rights reserved.
Bash Script
Cheat Sheet
function_name(
array=("elemen
A collection of elements accessed using ){ Declare a function with specified
t1" "element2"
numerical indices # code function name
"element3"...)
}
declare -A
array1
array1["elemen A collection of elements accessed using Call a function with specified function
function_name
t1"]="value1" string indices name
array2["elemen
t2"]="value2"
Sequence of characters enclosed in
var="Hellow local
single or double quotes is treated as Declare a local variable inside a function
World" var_name=val
String
Exit a function and return a value of the
return
calling function
Boolean Operators
&& Logical AND operator Arithmetic Conditional Operators
Equals to mathematical < operator(less
|| Logical OR operator -lt
than)
Equals to mathematical >
! NOT equal to operator -gt
operator(greater than)
Equals to mathematical <= operator(less
-le
than equal)
Equals to mathematical >=
String Comaprison Opearators -ge
operator(greater than equal)
Equals to mathematical ==
= equal -eq
operator(equal)
Equals to mathematical != operator(not
!= not equal -ne
equal)
< less then
> greater then
-n str1 string str1 is not empty
-z str2 string str2 is empty
Prepared By: Md Zahidul Islam Laku Copyright ©2023 linuxsimply.com| All rights reserved.
Bash Script
Cheat Sheet
String Manipulation
Prepared By: Md Zahidul Islam Laku Copyright ©2023 linuxsimply.com| All rights reserved.