Posted Dec 2, 2012 18:44 UTC (Sun) by bokr
In reply to: Shell programming
Parent article: Quotes of the week
kwds="$(echo $@|tr ' ' '+')"
firefox $ffarg &
I like being able to make things easy for myself ;-)
I prefer typing "wkf something" over Alt-Tabbing to firefox (if it's running or grabbing the mouse and clicking a sys tray icon if it's not), and then
mousing down a menu to select wikipedia (if it's set to google) and then
clicking focus to the search slot if necessary, and typing in "something" there.
It's so easy to make a little utility command. If I look up something on
on the net more than a few times, like as not I'll put a little script for
it in my ~/bin (which is on my $PATH), e.g. areagrep to look up areacodes,
ccgrep to look up country codes, airpgrep to look up airports and their codes, etc. (most of these work by a 2-line bash prefix calling grep on the rest of the file as a heredoc, or even grepping $0 and exiting, where
the heredoc is made by pasting a table copied from some public web page e.g. areacodes from wikipedia for areagrep. They nicely made it easy to
search for specific areacodes by suffixing a colon to area code in the text. So
[18:48 ~/bin]$ areagrep 206:
206: State of Washington (Seattle, all of Bainbridge, Mercer, and Vashon islands, Burien, Des Moines, Lake Forest Park, Normandy Park, Sea-Tac, Shoreline, Tukwila, and some small unincorporated areas adjacent to these. Also, parts of Woodway and Edmonds)
[18:48 ~/bin]$ areagrep 212:
212: New York City (Manhattan except for Marble Hill)
Also it's nice to be able to get any result that comes from these
little trivial utilities right into vim, just typing in vim, e.g., ":r!areagrep 212:"
I have a collection of throwntogether stuff, which I think would grow
even faster if command line access to clipboard and running programs
were more standard and less arcane.
E.g., for x clipboard stuff I had to get xclip and compile it, and
to get text dynamically from the web may involve e.g. getting wget to impersonate firefox and filtering through an adhoc python script.
But bottom line:
I think there's a bright future for command line input to computers ;-)
to post comments)