Timeline for Making an acronym
Current License: CC BY-SA 3.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Mar 15, 2016 at 13:58 | history | edited | cat | CC BY-SA 3.0 |
corrected spelling
|
| S Mar 15, 2016 at 13:58 | history | suggested | Erik the Outgolfer | CC BY-SA 3.0 |
corrected spelling
|
| Mar 15, 2016 at 13:51 | review | Suggested edits | |||
| S Mar 15, 2016 at 13:58 | |||||
| Mar 15, 2016 at 12:33 | comment | added | rexkogitans |
Maybe I was thinking too complicated, as in the grep-step the input is line by line, so [[ $i =~ ^(AND|OR|BY|OF)$ ]] would have also worked, but is 2 bytes longer.
|
|
| Mar 15, 2016 at 12:08 | comment | added | manatwork |
The word boundary is still \b, just needs to escape the \ with another one. But unfortunately it works only with compat31 shell option set (shopt -s compat31). By the way, the grep way can also be written shorter without \b: grep -qwE 'AND|OR|BY|OF'
|
|
| Mar 15, 2016 at 12:01 | comment | added | rexkogitans |
I was looking for the bash notation similar to grep's \b but couldnot find it... And I did not know that do...done can be replace by curly braces.
|
|
| Mar 15, 2016 at 11:58 | history | edited | rexkogitans | CC BY-SA 3.0 |
Two versions two show honestly that I didnot find the correct syntax avoiding grep.
|
| Mar 15, 2016 at 11:45 | comment | added | manatwork |
One more thing: you could replace the echo with printf. Furthermore you can apply Digital Trauma's brace tip too. (More in Tips for golfing in Bash.) for i in ${@^^};{ [[ $i = @(AND|OR|BY|OF) ]]||printf %c $i;}
|
|
| Mar 15, 2016 at 11:37 | comment | added | manatwork |
Looks much better. Now please replace the grep call with [[ $i = @(AND|OR|BY|OF) ]]. ;) And with that you can also remove the " + GNU coreutils" part from the post header.
|
|
| Mar 15, 2016 at 11:36 | comment | added | rexkogitans | @manatwork, good point, didnot think of that... | |
| Mar 15, 2016 at 11:35 | history | edited | rexkogitans | CC BY-SA 3.0 |
without awk
|
| Mar 15, 2016 at 11:29 | comment | added | manatwork |
Sorry, but that awk call looks horrible. What about replacing it with ${@^^}?
|
|
| Mar 15, 2016 at 11:22 | history | edited | rexkogitans | CC BY-SA 3.0 |
deleted 3 characters in body
|
| Mar 15, 2016 at 11:15 | history | answered | rexkogitans | CC BY-SA 3.0 |