...making Linux just a little more fun!
[ In reference to "2-Cent Tips" in LG#166 ]
Ben Okopnik [ben at linuxgazette.net]
----- Forwarded message from Rob Reid -----
Date: Thu, 3 Sep 2009 22:04:21 -0400 From: Rob Reid <xxxxx@nrao.edu> To: ben@linuxgazette.net Subject: tkb: Re: 2-cent Tip: Conditional pipesHi Ben,
I'm glad to see the nitty-gritty of shells and terminals being dealt with in Linux Gazette. One thing that might have been unclear to the reader is that the
LESS=FX less
syntax is (ba|z)sh code for "run less with the LESS variable set to FX for this time only". As you probably know, you could alternatively put
export LESS="-FRX" # The R is for handling color.
in your ~/.profile to have less nicely customized everytime you run it, with less typing.
-- Rob Reid https://www.cv.nrao.edu/~rreid/ Assistant Scientist at the National Radio Astronomy Observatory Isn't it a bit unnerving that doctors call what they do "practice?" - Jack Handey
Ben Okopnik [ben at linuxgazette.net]
On Mon, Sep 07, 2009 at 08:37:11AM -0500, Rob Reid wrote:
> > Hi Ben, > > I'm glad to see the nitty-gritty of shells and terminals being dealt with in > Linux Gazette. One thing that might have been unclear to the reader is that > the > > LESS=FX less > > syntax is (ba|z)sh code for "run less with the LESS variable set to FX for this > time only".
Lest we forget, KSH (in fact, any Bourne-derived shell) also allows this.
> As you probably know, you could alternatively put > > export LESS="-FRX" # The R is for handling color. > > in your ~/.profile to have less nicely customized everytime you run it, with > less typing.
Actually, I find that most people know about the 'export foo=bar' syntax, while relatively few know about the 'temporary' version - and that's a shame, because it's really useful. You can temporarily change the values of certain variables without messing up your environment, e.g.
# Change the editor used to edit 'crontab' EDITOR=/usr/bin/vim crontab -e # Set the language and the collation type for a given file LANG=ru_RU LC_CTYPE=ru_RU xterm -e vi russian_text.koi
If you wanted to print a man page, you could temporarily unset the PAGER variable and get the entire thing:
PAGER= man cat|lpr
You can import variables into programs - e.g.
foo=bar perl -wle'print "My foo is set to $ENV{foo}!"'
Setting proxies, etc. for a given connection isn't a problem either:
HTTP_PROXY=https://foo.bar.com:8080/ lynx https://okopnik.com
-- * Ben Okopnik * Editor-in-Chief, Linux Gazette * https://LinuxGazette.NET *