Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look into shell-supported data structures #27

Open
nkantar opened this issue Feb 21, 2021 · 4 comments
Open

Look into shell-supported data structures #27

nkantar opened this issue Feb 21, 2021 · 4 comments

Comments

@nkantar
Copy link
Owner

nkantar commented Feb 21, 2021

It would appear at least Bash actually supports at least arrays. It's possible that support for these might be beneficial.

@nkantar nkantar self-assigned this Feb 21, 2021
@P403n1x87
Copy link

It looks like it's not possible to export arrays in Bash:

$ export ARRAY=(1 2 3)
$ env | grep ARRAY
$

@goodwillcoding
Copy link
Collaborator

goodwillcoding commented Feb 21, 2021

$ declare -a ARRAY
$ ARRAY=(1 2 3)
$ echo ${ARRAY}
1
$ echo ${ARRAY[*]}
1 2 3
$ for i in ${ARRAY[*]}; do echo ${i}; done
1
2
3
$ echo ${ARRAY[1]}
2

@goodwillcoding
Copy link
Collaborator

goodwillcoding commented Feb 21, 2021

array and associative arrays (dicts/hashes) are supported: https://www.shell-tips.com/bash/arrays/

@P403n1x87
Copy link

$ export TEST=(1 2 3)
$ python3 -c "import os; print(os.getenv('TEST'))"
None
$ TEST=(1 2 3) python3 -c "import os; print(os.getenv('TEST'))"
(1 2 3)

@nkantar nkantar removed their assignment Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants