Asad Siddiqui
← Writing

January 6, 2024

Shell scripting

Shell scripting

Looping over arrays:

- Defining arrays is a new way. Parenthesis and lack of commas between elements

array_1=("some" "thing" "new")

- Don't forget to add done at the end of 'for' loop:

for element in "${array_1[@]}"; do

...

done

- Finding data types was difficult as basic type is string. This is one reason why programming languages may be preferred.

Functions:

- function someFunc() { ...}

- note: parameters are not defined in the parenthesis like other programming languages

- parameters can be accessed via $1, $2 and on

- use return instead of exit (as it terminates the shell program entirely)