I’m trying to collect string values in a bash script. What’s the simplest way that I can append string values to a list or array structure such that I can echo them out at the end?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since Bash uses sparse arrays, you shouldn’t use the element count
${#arr}as an index. You can however, get an array of indices like this: