Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 433 Bytes

array_keys.sh.md

File metadata and controls

22 lines (18 loc) · 433 Bytes

array_keys

array_keys -- Gets an array's keys.

array_keys gets an array's keys.

Usage

// 1. Function form.
void func::array_keys(string[]* output, string[]* input)
// 2. Command form.
void sub::array_keys(string[]* input) > output

Examples

array=([0]=abc [2]=def)
EXPECT_EQ '0,2' "$(IFS=, sub::array_keys array)"
func::array_keys result array
EXPECT_EQ '0' "${result[0]}"
EXPECT_EQ '2' "${result[1]}"