Quantcast
Channel: What is the difference between double-quoting and not double-quoting an array in Bash? - Unix & Linux Stack Exchange
Browsing index pages (4 articles)
↧

What is the difference between double-quoting and not double-quoting an array...

While tracking down an error in my shellscript, I found the following behavior in this code snippet:declare -a filelistreadarray filelist < <(ls -A)readonly filelistfor file in "${filelist[@]}";...

View Article


Answer by user232326 for What is the difference between double-quoting and...

There is absolutely no problem with quoting an array expansion.And, of course, there is no problem with no quoting it either as long as you know and accept the consequences. Any non-quoted expansion is...

View Article


Answer by DopeGhoti for What is the difference between double-quoting and not...

Part of the problem based on your code snippet may be that you're parsing the output of ls. This is dangerous and fraught with myriad issues and is best avoided.Rather thandeclare -a filelistreadarray...

View Article

Answer by ilkkachu for What is the difference between double-quoting and not...

I'm not worried about word splitting in this caseWell, in fact, you're relying on it to remove the trailing newline from array entries!Bash's readarray (mapfile) leaves the delimiters in by default....

View Article
Browsing index pages (4 articles)


Latest Images