for url in `< urls`; do curl $url; done
xargs curl < urls
cat image.png | pngview" and have that just show the image inline. I'd be very happy if that just worked while I was logged in over ssh.
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
#!/bin/bash for i in `cat urls` do curl -O $i done..but this fails if a URL has a space. You can play games with the IFS variable and dance around this, but it's not really the way. There is a tool to take a collection of lines and offer them as a set of eXtended ARGumentS. It's called cat...if you spell cat "xargs"
for files in `ls files`... while `ls files`....what they really are, when evaluated by the shell, is this:
for files in (file1 file2 file3 file4 file5.......fileN) while files in (file1 file2 file3 file4 file5.......fileN)and if N is large enough, you run into the maximum length of a line restriction of a shell, and it fails. This is the source of the 'how do I delete all these files, rm * isn't working" posts that litter the net. The answer is xargs, which will recast
for i in `ls $files` do something $files done...to...
something $file1 something $file2 something $file3 .... something $fileN...all of which fit, even if N is very large. So, the best, and simplest, and as so often true of the Unix shells, the *shortest* way to take a list of URls and feed them to curl is
lsls | grep fools and pull up metadata on one of the files?sed lets you do with columnar data! But none of that is useful for very much in 2011 except for dealing with the output of other basic shell programs. I would love to be able to do something like:for url in `xpath http://example.com/url-list.xml < /some/path[@link=unexpired]/to/urls`; do curl $url; donelsof output? There's no good reason this stuff doesn't exist.ls -l might print a summary line explaining what the various fields mean. Importantly, there would need to be a mechanism to only print this information to the terminal, not pass it on to other programs. Or what if you could mouse over or right-click the "r-xr-xr-x" portion and get a tooltip explanation of what means?To disable pagination for all commands, set core.pager or GIT_PAGER to cat.posted by jepler at 6:54 AM on May 19, 2011
for url in `< urls`; do curl $url; doneI was going to say
cat urls.txt | xargs curl, although apparently cat is unnecessary here. If you want to filter the URLs with grep or something you can do cat | grep | xargs, which is nice.
We choose language to interact with each other because it provides us the ability to synthesize new symbols as rapidly as we think. This effect is just as true in the realm of computer-mediated human interaction, and it should not be forgotten.I know when my mom first got email I taught her how to check it using a command line. She would actually modem in (rather then use telnet or something) and check her mail that way and it was pretty easy to teach her. She just had to memorize a few commands and that was it.
I think we use Unix because it is more human, not less, than a visual interface. Text streams are archaic, but not more so than any human language.
And that's why visual output is dead -- you can't use it as input to something else. It's pretty, sure, but dead. Kind of like hair.Why not?
script commandscriptpngview > image.pngpngview < image.png convert label:"take the ring finger on your left hand and touch the spot two inches over from the left side of your desk" command.pngOh, good grief. It's the DOS vs. Mac arguments all over again in this thread, only the DOS kids have all learned a smattering of Unix shell commands, and think they're something.If reading flame wars grieves you, it helps to avoid posting anything inflammatory.
ps -efacat command is overused in the shell. It is unnecessary filler, and I should stop using it, just as my little sister should stop saying 'like' so much.This seems like an okay choice, until you start to factor in the biggest lesson learned on the web: there is no such thing as plain text.I don't know that this is the biggest lesson learned on the web at all. If anything, the web taught me that "chaos works and nothing matters, least of all character encodings".
git config --global core.pager cat
killall httpd but that gave me an error. So I did what I usually did when that happened, and typed killall by itself hoping to get some guidance.rm -rf .*)git config --global core.pager ''I would love to be able to do something like:The CLI fairy has granted your wish!
for url in `xpath http://example.com/url-list.xml < /some/path[@link=unexpired]/to/urls`; do curl $url; done
curl http://example.com/url-list.xml |xmlstarlet sel -t -m //*[@link=unexpired] -v ./to/urls -n |xargs wget --mirror --xmlstarlet sel is a rather clever way to write XSLT from a few command line flags.
"I wrote The Art of Unix Programming and yield to no one in my appreciation of old-school Unix virtues. And I think most of the negative comments here are bunk. The Unix tradition is not a fossil or a museum exhibit, and it ill behooves those of us who value it to behave like grouchy old farts when someone brings fresh thinking to its problems.posted by verb at 5:49 PM on May 19, 2011 [3 favorites]
I think the convention of using JSON for the view pipes is particularly clever and appropriate. It's an excellent way of preserving the old-school virtues of textuality while also supporting the ability to pass structured objects around.
If Steve Witten ships this for Linux I'll try it out."
perl -e 'while(<>) {@x = /e/g; print unless @x == 17}'
>« Older What is a library? What do librarians do?... | "Sometimes less," he... Newer »
This thread has been archived and is closed to new comments
If by "just work" you mean "do what the computer thinks you want". If I want to view a PNG, I'll launch gqview or something. If I say cat what I want is to see some binary.
If I wanted a computer that thought it was smarter than me, I would just use OSX to begin with.
That said, I'll check it out because some of the other stuff looks potentially interesting.
posted by DU at 4:26 AM on May 19, 2011 [12 favorites]