News for hackers. Stuff that matters.
Re:4B If Statements by johnfn on Thursday December 28, 2023 @02:03PM (#38797178)
It's weird to me that in every other comment thread on Hacker News, people say "good software should do one thing and do it well". And then the topic moves to NPM, and suddenly everyone loses their mind?
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
Re:4B If Statements by jrockway on Thursday December 28, 2023 @02:48PM (#38797736)
A little copying is better than a little dependency.
Re:4B If Statements by lolc on Thursday December 28, 2023 @02:38PM (#38797605)
Haha ok do something substantial! It's implied.