[LatinaLUG] corso bash: comandi e sostituzioni

Roberto Polli robipolli@gmail.com
Mar 4 Dic 2012 11:47:13 CET


Come detto al corso, lanciando il comando seguente e premendo DUE VOLTE invio ;)
#man bash | less +/\!! ;


   Event Designators
       An event designator is a reference to a command line entry in
the history  list.   Unless  the
       reference is absolute, events are relative to the current
position in the history list.

       !      Start  a  history  substitution,  except  when  followed
 by a blank, newline, carriage
              return, = or ( (when the extglob shell option is enabled
using the shopt builtin).
       !n     Refer to command line n.
       !-n    Refer to the current command minus n.
       !!     Refer to the previous command.  This is a synonym for `!-1'.
       !string
              Refer to the most recent command preceding the current
position  in  the  history  list
              starting with string.
       !?string[?]
              Refer  to  the  most recent command preceding the
current postition in the history list
              containing string.  The trailing ? may be omitted if
string is followed immediately  by
              a newline.
       ^string1^string2^
              Quick  substitution.   Repeat  the  previous  command,
replacing string1 with string2.
              Equivalent to ``!!:s/string1/string2/'' (see Modifiers below).
       !#     The entire command line typed so far.

   Word Designators
       Word designators are used to select desired words from the
event.  A  :  separates  the  event
       specification  from the word designator.  It may be omitted if
the word designator begins with
       a ^, $, *, -, or %.  Words are numbered from the beginning of
the line, with  the  first  word
       being  denoted by 0 (zero).  Words are inserted into the
current line separated by single spa‐
       ces.

       0 (zero)
              The zeroth word.  For the shell, this is the command word.
       n      The nth word.
       ^      The first argument.  That is, word 1.
       $      The last argument.
       %      The word matched by the most recent `?string?' search.
       x-y    A range of words; `-y' abbreviates `0-y'.
       *      All of the words but the zeroth.  This is a synonym for
`1-$'.  It is not an  error  to
              use  *  if  there  is  just one word in the event; the
empty string is returned in that
              case.
       x*     Abbreviates x-$.
       x-     Abbreviates x-$ like x*, but omits the last word.


Maggiori informazioni sulla lista latina