Timeline for Is it possible to pass a bash array as a parameter to a function?
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 17, 2022 at 7:13 | comment | added | Nickotine | @StéphaneChazelas do you agree that this is a duplicate? in my opinion the other question is asking multiple things and is much harder to read, the accepted answer for that question doesn’t even answer this question, your answer is very clear, unlike the one in the other question. | |
| Aug 15, 2022 at 11:13 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 486 characters in body
|
| Aug 15, 2022 at 10:53 | comment | added | Stéphane Chazelas |
@annahri, typeset is the name used by the Korn shell from the earlier 80s (where bash copied that feature) and most other shells, so I prefer that one. I also prefer readarray over mapfile as that's not doing a mapping, only a reading (and zsh had a (real) mapfile feature long before bash introduced its mapfile / readarray builtin)
|
|
| Aug 15, 2022 at 10:51 | comment | added | Stéphane Chazelas | @Nickotine, see edit. | |
| Aug 15, 2022 at 10:51 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 181 characters in body
|
| Aug 15, 2022 at 10:47 | comment | added | annahri |
Any reason, why use typeset instead of declare?
|
|
| Aug 15, 2022 at 10:42 | comment | added | Nickotine |
@StéphaneChazelas are the underscores necessary? This worked fine for me arrLen() { typeset -n Var="$1"; echo "${#Var[@]}"; }
|
|
| Aug 15, 2022 at 10:39 | comment | added | Nickotine | Thanks a lot @StéphaneChazelas works perfectly | |
| Aug 15, 2022 at 10:38 | vote | accept | Nickotine | ||
| Aug 15, 2022 at 10:26 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 121 characters in body
|
| Aug 15, 2022 at 10:21 | history | answered | Stéphane Chazelas | CC BY-SA 4.0 |