Bash (Borne Again Shell)
[top]
Arrays
ARRAY=('item1' 'item2' 'item3');
item1 = $ARRAY[0];
item2 = $ARRAY[1];
item3 = $ARRAY[2];
Set an array with three items. Then set a seperate variable to each array element's item name.
[top]
Functions
myfunc() {
...
param1 = $1;
param2 = $2;
param3 = $3;
function contents
...
}
myfunc ;
Set function and get the parameters passed.
myfunc ("item1" "item2" "item3");
Call function and pass in three parameters.
Cheatsheets






