S
S
shell_guy2021-12-08 12:23:44
bash
shell_guy, 2021-12-08 12:23:44

How to add multiple values ​​(array) to a variable?

export mac=("mac1" "mac2")
echo $mac only displays 1.
What's wrong?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2021-12-09
@shell_guy

1. Spaces first:
mac=( "mac1" "mac2" )
2. Second,
echo ${mac[0]}
echo ${mac[1]}
3. Third,
export is completely pointless in this case, so as an array cannot be sent to environment variables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question