Skip to main content
3 of 6
added 116 characters in body
ilkkachu
  • 147.9k
  • 16
  • 268
  • 441

In Bash, you can use pattern substitution to prepend -l to each array element. You may then redefine your array like this:

array=( "${array[@]/#/-l}" )

Note that if the source was sparse, a relatively uncommon case, this will reset the indexes to 0 through N-1.