Timeline for Insist on an answer
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 21 at 10:58 | comment | added | Toby Speight | Instead of the first read, remember you can have multiple commands between while and do: while read a;! [ "$a" ];do :;done | |
| May 4, 2017 at 23:36 | comment | added | Chris | One tip- you don't need the first read a, since bash variables that are not set are empty by default. | |
| May 4, 2017 at 23:25 | comment | added | Dennis | @Yeti All of these need double quotes or they will fail if the input contains whitespace. You should be able to get rid of the spaces surrounding || though. | |
| May 4, 2017 at 23:21 | comment | added | Dennis | For a pure Bash solution, there's while [ ! "$a" ];do read a;done or something similar with recursion. | |
| May 4, 2017 at 18:27 | comment | added | Yeti | Got rid of the -z too: [ `head -n1` ] || $0 (21 bytes) or [ `line` ] || $0 (17 bytes). | |
| May 4, 2017 at 18:20 | comment | added | Yeti | Well, also the first time for me :) But you could perhaps use recursion: [ -z `line` ] && $0 or if the deprecated line is not on your system: [ -z `head -n1` ] && $0. That should either be 20 or 24 bytes. | |
| May 4, 2017 at 11:35 | history | edited | Nicolas Fischer | CC BY-SA 3.0 | added 27 characters in body |
| May 4, 2017 at 9:35 | comment | added | 12431234123412341234123 | you do not need #!/bin/bash | |
| May 4, 2017 at 9:14 | comment | added | Nicolas Fischer | @ConnorLSW Wow, thanks, that Post will help me a lot. I'll try to edit my Answer with this new tips ASAP. | |
| May 4, 2017 at 8:25 | comment | added | colsw | Welcome to PPCG!, if you're planning on using Bash as a golfing language you might find This Post Interesting, it has a bunch of tips for making bash programs as small as humanly possible, there's also a More General Version you might want to skim through too. | |
| May 4, 2017 at 8:22 | comment | added | Adám | Welcome to PPCG. | |
| May 4, 2017 at 8:20 | review | First posts | |||
| May 4, 2017 at 8:44 | |||||
| May 4, 2017 at 8:19 | history | answered | Nicolas Fischer | CC BY-SA 3.0 |