-
Notifications
You must be signed in to change notification settings - Fork 55
/
example.sh
executable file
·50 lines (38 loc) · 946 Bytes
/
example.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
. ticktick.sh
bob=Bob
``
people = {
"HR" : [
"Alice",
$bob,
"Carol"
],
"Sales": {
"Gale": { "profits" : 1000 },
"Harry": { "profits" : 500 }
}
}
``
function printEmployees() {
echo
echo " The ``people.Engineering.length()`` Employees listed are:"
for employee in ``people.Engineering.items()``; do
printf " - %s\n" "${!employee}"
done
echo
}
echo Base Assignment
`` people.Engineering = [ "Darren D", "Edith E", "Frank F" ] ``
printEmployees
newPerson="Isaac I"
echo Pushed a new element by variable, $newPerson onto the array
`` people.Engineering.push($newPerson) ``
printEmployees
echo Shifted the first element off: `` people.Engineering.shift() ``
printEmployees
echo Popped the last value off: `` people.Engineering.pop() ``
printEmployees
echo Indexing an array, doing variable assignments
person0=``people.HR[0]``
echo $person0 ``people.HR[1]``