[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] What is the most efficient way to extract the first element
From: |
Peng Yu |
Subject: |
[Help-bash] What is the most efficient way to extract the first element of "address@hidden"? |
Date: |
Wed, 21 Feb 2018 22:57:09 -0600 |
Hi,
I have to assign "address@hidden" to an array and then extract the first
element. If I understand it correctly, this will involve an extra copy
which may be slow for large arrays. Is there a syntax that allows the
direct extraction of the first element of "address@hidden"? Thanks.
$ x=()
$ x[10]=a
$ x[2]=b
$ i=("address@hidden")
$ echo "${i[0]}"
2
--
Regards,
Peng
- [Help-bash] What is the most efficient way to extract the first element of "address@hidden"?,
Peng Yu <=