Skip to content

Commit a77aa76

Browse files
authored
Update II Variables in Bash Scripting.py
1 parent b775dd2 commit a77aa76

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Introduction to Bash Scripting/II Variables in Bash Scripting.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,23 @@
174174
echo ${my_array[@]}
175175
100 113 240 555 66 10
176176
177-
*** Associative array
177+
*** Associative array (KAY_VALUE)
178+
a Dictionary in python
179+
180+
# first declare
181+
declare -A city_details
182+
183+
# now fill
184+
city_details=([c_name]='NY' [Population]=1400000)
185+
186+
# or single line
187+
declare -A city_details=([keys]=values)
188+
189+
# index using keys to return value
190+
echo ${city_details[c_name]}
191+
NY
178192
193+
*** Access KEYS (!)
194+
>>>>>> echo ${!citydetails[@]}
195+
c_nama Population
196+
"""

0 commit comments

Comments
 (0)