Why use ${REPLY:0:1} and not $REPLY
What are the semicolon values for - is it to shift values?
Code:
echo -e "Do you wish to restore all these file(s)/directory(ies)? [Enter Y to restore all; N to choose single file]: \c" |
To me, it's look like 'getopts' command line aguments. Can you post full script?
|
That's how you extract a substring from a string in BASH
http://tldp.org/LDP/abs/html/refcards.html#AEN22664 All they're doing is extracting the first character from whatever the user entered and checking if it's a y or Y. |
Quote:
|
BTW, the above could be made much cleaner. At the very least the two separate pattern matches can be combined into one: You can also fix it to match the first character directly instead of using the parameter substitution to extract it first.
Code:
if [[ ${REPLY:0:1} = [yY] ]]; then Code:
case ${REPLY,,} in |
All times are GMT -5. The time now is 06:25 AM. |