Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue]master #[/blue] date -u
Fri Feb 10 16:47:20 UTC 2006
[blue]master #[/blue] cal 2006 | less
[blue]master #[/blue] [gray]# other command, with name [b]not[/b] begining with "d"[/gray]
[blue]master #[/blue] if !d | grep -q Fri; then echo "weekend approaching"; fi
weekend approaching
man_bash said:Event Designators
An event designator is a reference to a command line entry 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 line minus n.
!! Refer to the previous command. This is a synonym for `!-1'.
!string
Refer to the most recent command starting with string.
!?string[?]
Refer to the most recent command containing string. The trailing ? may be omitted if string is followed immedi-
ately by a newline.
^string1^string2^
Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to
``!!:s/string1/string2/'' (see Modifiers below).
!# The entire command line typed so far.
[blue]master #[/blue] echo "This works" > samplefile
[blue]master #[/blue] '!/ABC/' samplefile
This works
[blue]master #[/blue] awk " !/ABC/" samplefile
bash: !/ABC/": event not found
[blue]master #[/blue] awk \!"/ABC/" samplefile
This works
man bash said:Several shell options settable with the shopt builtin may be used to tailor the behavior of history expansion. If the histverify shell option is enabled (see the description of the shopt builtin), and readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the readline editing buffer for further modification. If readline is being used, and the histreedit shell option is enabled, a failed history substitution will be reloaded into the readline editing buffer for correction. The -p option to the history builtin command may be used to see what a history expansion will do before using it. The -s option to the history builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall.
The shell allows control of the various characters used by the history expansion mechanism (see the description of histchars above under Shell Variables).
Event Designators
An event designator is a reference to a command line entry in the history list.
!
Start a history substitution, except when followed by a blank, newline, = or (.
!n
Refer to command line n.
!-n
Refer to the current command line minus n.
!!
Refer to the previous command. This is a synonym for `!-1'.
!string
Refer to the most recent command starting with string.
!?string[?]
Refer to the most recent command containing string. The trailing ? may be omitted if string is followed immediately by a newline.
^string1^string2^
Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to ``!!:s/string1/string2/'' (see Modifiers below).
!#
The entire command line typed so far.
aix man page on AIX said:'Program'
Contains the instructions for the awk command. If the -f flag is
not specified, the Program variable should be the first item on
the command line. It should be bracketed by ' ' (single quotes).