Skip to main content

All Questions

Tagged with
2 votes
1 answer
69 views

Why isn't the `else` arm executed in this Bash script (for loop through an array)?

The following code is meant to look for subdirectories in ~/Downloads. I run it with . ./script.sh. It will find them even when the user submits an incomplete name. #!/usr/bin/bash echo -e "\...
John Smith's user avatar
1 vote
2 answers
2k views

Array Declaration: Double Quotes & Parentheses

Perhaps this is a stupid question but two hours on Google hasn't turned up anything on point. Simply, does a difference exist in Bash between: X=" a b c " and X=( a b c ) The former ...
ebsf's user avatar
  • 399
4 votes
2 answers
1k views

Bash's read builtin errors on a string-based timeout option specification but not an array-based one. Why?

In reading through the source to fff to learn more about Bash programming, I saw a timeout option passed to read as an array here: read "${read_flags[@]}" -srn 1 && key "$REPLY&...
qmacro's user avatar
  • 143