Bash array using system positions limits? [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Here is my array declaration



arraySYSTEM=( "$@" )


It can have up to 10 "system position(?)" members.



I'm using it to build text parameters passed to whiptail function. Then I select the parameter using whiptail checklist (menu). In checklist I can have unlimited number of parameters using $number syntax - such as $16.



How do I modify my arraySYSTEM declaration to have more that 10 members in an array?










share|improve this question















closed as unclear what you're asking by Michael Homer, Thomas, G-Man, msp9011, roaima Aug 20 at 13:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 8




    Who says that array can have only up to 10 values?
    – muru
    Aug 20 at 4:06










  • If I code this way $10 it fails - highlights the "0" so $10 is OK. Perhaps using wrong syntax WAS my initial error.
    – Jan Hus
    Aug 20 at 16:07














up vote
1
down vote

favorite












Here is my array declaration



arraySYSTEM=( "$@" )


It can have up to 10 "system position(?)" members.



I'm using it to build text parameters passed to whiptail function. Then I select the parameter using whiptail checklist (menu). In checklist I can have unlimited number of parameters using $number syntax - such as $16.



How do I modify my arraySYSTEM declaration to have more that 10 members in an array?










share|improve this question















closed as unclear what you're asking by Michael Homer, Thomas, G-Man, msp9011, roaima Aug 20 at 13:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 8




    Who says that array can have only up to 10 values?
    – muru
    Aug 20 at 4:06










  • If I code this way $10 it fails - highlights the "0" so $10 is OK. Perhaps using wrong syntax WAS my initial error.
    – Jan Hus
    Aug 20 at 16:07












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Here is my array declaration



arraySYSTEM=( "$@" )


It can have up to 10 "system position(?)" members.



I'm using it to build text parameters passed to whiptail function. Then I select the parameter using whiptail checklist (menu). In checklist I can have unlimited number of parameters using $number syntax - such as $16.



How do I modify my arraySYSTEM declaration to have more that 10 members in an array?










share|improve this question















Here is my array declaration



arraySYSTEM=( "$@" )


It can have up to 10 "system position(?)" members.



I'm using it to build text parameters passed to whiptail function. Then I select the parameter using whiptail checklist (menu). In checklist I can have unlimited number of parameters using $number syntax - such as $16.



How do I modify my arraySYSTEM declaration to have more that 10 members in an array?







bash array






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 22 at 7:33









αғsнιη

15.8k92563




15.8k92563










asked Aug 20 at 3:19









Jan Hus

1266




1266




closed as unclear what you're asking by Michael Homer, Thomas, G-Man, msp9011, roaima Aug 20 at 13:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Michael Homer, Thomas, G-Man, msp9011, roaima Aug 20 at 13:57


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 8




    Who says that array can have only up to 10 values?
    – muru
    Aug 20 at 4:06










  • If I code this way $10 it fails - highlights the "0" so $10 is OK. Perhaps using wrong syntax WAS my initial error.
    – Jan Hus
    Aug 20 at 16:07












  • 8




    Who says that array can have only up to 10 values?
    – muru
    Aug 20 at 4:06










  • If I code this way $10 it fails - highlights the "0" so $10 is OK. Perhaps using wrong syntax WAS my initial error.
    – Jan Hus
    Aug 20 at 16:07







8




8




Who says that array can have only up to 10 values?
– muru
Aug 20 at 4:06




Who says that array can have only up to 10 values?
– muru
Aug 20 at 4:06












If I code this way $10 it fails - highlights the "0" so $10 is OK. Perhaps using wrong syntax WAS my initial error.
– Jan Hus
Aug 20 at 16:07




If I code this way $10 it fails - highlights the "0" so $10 is OK. Perhaps using wrong syntax WAS my initial error.
– Jan Hus
Aug 20 at 16:07










1 Answer
1






active

oldest

votes

















up vote
4
down vote













You can have any number of entries in an array. For example:



$ set -- a..z
$ echo "$26"
z


(beware $26 is $26 in bash and most other Bourne-like shells)



Ditto for a named array:



$ foo=(a..z)
$ echo "$foo[25]"
z


(The indexing discrepancy is because $0 is special, usually containing the name of the current script.)






share|improve this answer


















  • 3




    Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
    – Stéphane Chazelas
    Aug 20 at 6:25

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote













You can have any number of entries in an array. For example:



$ set -- a..z
$ echo "$26"
z


(beware $26 is $26 in bash and most other Bourne-like shells)



Ditto for a named array:



$ foo=(a..z)
$ echo "$foo[25]"
z


(The indexing discrepancy is because $0 is special, usually containing the name of the current script.)






share|improve this answer


















  • 3




    Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
    – Stéphane Chazelas
    Aug 20 at 6:25














up vote
4
down vote













You can have any number of entries in an array. For example:



$ set -- a..z
$ echo "$26"
z


(beware $26 is $26 in bash and most other Bourne-like shells)



Ditto for a named array:



$ foo=(a..z)
$ echo "$foo[25]"
z


(The indexing discrepancy is because $0 is special, usually containing the name of the current script.)






share|improve this answer


















  • 3




    Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
    – Stéphane Chazelas
    Aug 20 at 6:25












up vote
4
down vote










up vote
4
down vote









You can have any number of entries in an array. For example:



$ set -- a..z
$ echo "$26"
z


(beware $26 is $26 in bash and most other Bourne-like shells)



Ditto for a named array:



$ foo=(a..z)
$ echo "$foo[25]"
z


(The indexing discrepancy is because $0 is special, usually containing the name of the current script.)






share|improve this answer














You can have any number of entries in an array. For example:



$ set -- a..z
$ echo "$26"
z


(beware $26 is $26 in bash and most other Bourne-like shells)



Ditto for a named array:



$ foo=(a..z)
$ echo "$foo[25]"
z


(The indexing discrepancy is because $0 is special, usually containing the name of the current script.)







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 20 at 6:12









Stéphane Chazelas

285k53525864




285k53525864










answered Aug 20 at 4:27









l0b0

26.3k17106231




26.3k17106231







  • 3




    Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
    – Stéphane Chazelas
    Aug 20 at 6:25












  • 3




    Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
    – Stéphane Chazelas
    Aug 20 at 6:25







3




3




Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
– Stéphane Chazelas
Aug 20 at 6:25




Note that the $26 being $26 Bourne design flaw (in the Bourne shell not even $26 worked though "$@" still included all elements) is fixed in csh, tcsh, zsh, rc, es...
– Stéphane Chazelas
Aug 20 at 6:25


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?