News for hackers. Stuff that matters.
Re:4B If Statements by throwitaway1123 on Thursday December 28, 2023 @04:04PM (#38798592)
This is part of the UNIX philosophy, but sometimes this gets taken way too far. There is of course the UNIX command "yes", which literally just prints the character "y" over and over again (to skip interactive prompts).
Re:4B If Statements by ericbarrett on Thursday December 28, 2023 @05:30PM (#38799546)
GNU yes will actually repeat any string—the default is of course "y". So it's very handy for scripting, and not really as single-purpose as you'd think.
Re:4B If Statements by throwitaway1123 on Thursday December 28, 2023 @05:58PM (#38799808)
Yeah it's definitely useful. Still a bash one liner though:

  function yes { while true; do echo "${1:-y}"; done }
Re:4B If Statements by rini17 on Friday December 29, 2023 @03:28AM (#38802809)
also, it's actually faster than reading /dev/zero if you need some filler data hahahaha