4 ms·
The Unix way: diff <(curl -vs https://news.ycombinator.com/ 2>&1) <(curl -vs https://news.ycombinator.com/ 2>&1) As a shell function: httpdiff () {
by tlrobinson 12y ago
The Unix way:
diff <(curl -vs https://news.ycombinator.com/ 2>&1) <(curl -vs https://news.ycombinator.com/ 2>&1)
As a shell function:
httpdiff () {
diff <(curl -vs "$1" 2>&1) <(curl -vs "$2" 2>&1)
}
httpdiff https://news.ycombinator.com/ https://news.ycombinator.com/
- jgrahamc 12y agoWhich works well for that one example. But not others. diff <(curl -Lvs https://www.google.com/ 2>&1) <(curl -Lvs http://www.google.com/ 2>&1) On my machine that produces 33k of output. I like one liners and using the shell, but this tool was built not for fun because I was debugging things that were painful.
- tlrobinson 12y agoThat's nothing a couple "1> /dev/null"'s can't solve (or redirect to a temporary file then "diff -q"). But yeah, yours is a bit nicer.
- Hello71 12y ago$ diff -y -W $COLUMNS <(curl -Lvs https://www.google.com/ 2>&1) <(curl -Lvs http://www.google.com/ 2>&1) Edit: furthermore, with curl you can use options like -b, -c, -d, which would all have to be reimplemented in your system.
- z1mm32m4n 12y agoIf you're worried about paging, you could always just pipe it to less, or if you still wanted colors you could swap out diff for vimdiff. Nice tool, though.
- SixSigma 12y agoCame here to say similar. "Those who don't understand Unix are condemned to reinvent it, poorly." – Henry Spencer
- NateDad 12y agoThere's this thing called ux... John's program has a nice one, diff and curl and bash (used together in the way indicated here) have a terrible one.
- deleted 12y ago[deleted]
- SixSigma 12y agoI said "similar", I use plan9 so my shell script would have been slight different and my interface cleaner. Using a 1970s TTY in the 21st century is dumb.
- jdc 12y agoHow does plan9 help make your interface cleaner?
- SixSigma 12y agoBecause I can use the built in plumber to do more interesting things. The terminal scrolls, I can send commands from the mouse interface. I would enhance the shell script a bit to output a few more commands, should I need them. If it was a tool I used regularly I could sharpen it.
- c22 12y agoIf you got it sharp enough would you share it?
- SixSigma 12y agoSure. But I have no interest in doing it right now. You can look at my shell script HTTP client if you like. http://plan9.bell-labs.com/sources/contrib/maht/rc/httplib.rc http://plan9.bell-labs.com/sources/contrib/maht/rc/httplib.r... and some of my other plan9 code http://plan9.bell-labs.com/sources/contrib/maht/ http://plan9.bell-labs.com/sources/contrib/maht/