About 10,800,000 results
Open links in new tab
  1. bash - How do I create an array in Unix shell scripting ... - Stack ...

    Dec 10, 2009 · For example, FreeBSD doesn't ship with bash (it's installable from ports though). Scripts written assuming bash features aren't portable, and they're noticably slower slower …

  2. Bash array declaration and appending data - Stack Overflow

    I'm trying to declare and append to an array in a bash script, after searching i resulted in this code.

  3. How to pass array as an argument to a function in Bash

    Here is an example where I receive 2 bash arrays into a function, as well as additional arguments after them. This pattern can be continued indefinitely for any number of bash arrays and any …

  4. Add a new element to an array without specifying the index in Bash

    Apr 28, 2020 · ARRAY=() ARRAY+=('foo') ARRAY+=('bar') Bash Reference Manual: In the context where an assignment statement is assigning a value to a shell variable or array index …

  5. Array of arrays in bash - Stack Overflow

    A bash array of arrays is possible, if you convert and store each array as a string using declare -p (see my function stringify). This will properly handle spaces and any other problem characters …

  6. Passing arrays as parameters in bash - Stack Overflow

    Jun 30, 2009 · Given bash array array1, the syntax to obtain all elements of this array is "${array1[@]}". Since all incoming parameters to a bash function or executable file get …

  7. Loop through an array of strings in Bash? - Stack Overflow

    Jan 16, 2012 · Without them, the for loop will break up the array by substrings separated by any spaces within the strings instead of by whole string elements within the array. ie: if you had …

  8. bash - Looping over arrays, printing both index and value - Stack …

    Mar 19, 2017 · Dump array in reusable format (without loop): pure bash, without loop and without fork, using two step, you could build a variable ready to re-define your array elsewhere.

  9. Creating array of objects in bash - Stack Overflow

    Is it possible to create an array of objects in bash? That's how I'm trying:

  10. Easiest way to check for an index or a key in an array?

    Nov 4, 2012 · @duanev: Without +abc, [ ${array[key]} ] will evaluate to false if the element is indeed set but to an empty value, so it's actually testing the value non-emptiness rather than …