for i in $(seq 2006 2013); do \!$i; done;
in your code, you may think ! is like ! in bash command line, but here "!" with the "$i" become a string like string command "!2006, !2007 ... !2013" but actually there is no command named "!2006" "!2006" in whole is a command name.
in Bash ! is a event designator. when you use !2006.
it is explained as "reference to command 2006" but not use command "!2006".
! is always left to right execute command.
for more information please visit http://www.gnu.org/software/bash/manual/bashref.html#Event-Designators
I try the following way to get the same result:
for i in $(seq 2006 2013); do fc -e - $i; done;
fc 2006 2013
will give you 8 command lines to edit and then execute whatever commands you leave in the file after exiting the editor. OK; sincebash
is playing tricks with us, we'll have to play tricks onbash
. Tellbash
to use:
as the editor:fc -e : 2006 2013
.for i in {2006..2013}; do fc -s $i; done
But @JonathanLeffler: trick of fooling BASH was also great usingfc -e :
:)