Your Ad Here

Sabtu, 22 September 2012

Unix Tip: HOW MANY COMMANDS HAVE I RUN?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3514 - September 22, 2012

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


HOW MANY COMMANDS HAVE I RUN?

If you're a csh/tcsh/zsh user, you've seen the supposed feature
that lets you display how many commands you've run in your
prompt:

set prompt="\! %"

The \! (or %h or %! for tcsh) displays not really a current
count of commands run, but the current history event number.

Think of it in those terms, and you'll discover it becomes quite
useful.

For example, how many times have you typed some enormously long
command line, only to have it fail because several other conditions
weren't met?

You spend the next several prompts typing various commands to
get conditions set up just right, and then have to retype the
entire long command.

Or, if it hasn't scrolled off the screen yet, just type ! followed
by the history event number displayed in the prompt for that big
long command. It's that simple:

prompt 23 % command -with some -very +long /argument/list
command: Example command failed.
prompt 24 % cd /to/correct/directory
prompt 25 % rm certain.files
prompt 26 % !23
command -with some -very +long /argument/list
command: Example command succeeds.
prompt 27 %

You can even apply the standard csh modifiers to !<number>. For
example, particularly useful is !<number>:p, which just prints
the command typed on prompt <number> instead of executing it
again:

prompt 26 % !23:p
command -with some -very +long /argument/list
prompt 27 % !!
command -with some -very +long /argument/list
command: Example command succeeds.
prompt 28 %


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Tidak ada komentar:

Posting Komentar

Your Ad Here
Free Automatic Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink