script interpreting - comma
I'm trying to understand how the following works exactly:
for file in /{,usr/}bin/*calc # ^ Find all executable files ending in "calc" #+ in /bin and /usr/bin directories. Does the comma simply mean that the word 'usr/' is optional? |
That is an example of brace expansion (see 'man bash' for further details). /{,usr/}bin/*.calc is expanded to /bin/*.calc and /usr/bin/*.calc
|
Not of much help, really. I know the idea behind brace expansion, but I don't understand the role of the comma there. Your explanation simply repeated what I've already pasted in my first post.
Does the comma refer to what is before it, i.e. nothing? So could it be that it's either nothing, or "usr/"? |
Yes
{a,b} expands to a and b {,b} expands to <nothing> and b |
Great. Thanks :)
|
All times are GMT -5. The time now is 02:05 AM. |