Re:Re: A wonderful idea about shell!

2008-05-27 Thread donglongchao
Dear Eric :
Thank you for your mail and response.
 I think that I could understand what you said in you mail,but it maybe 
could not fit what I really need in my last mail.
 I have try your method(the shotrcut -- control+r) and it is a very 
convenient tool for me because with it I could find everything using some keys.
 Maybe my poor english make you misunderstand what I said.:-)My real 
meaning in my last mail is that when we carry out a command exactly in a second 
time ,in fact we could not need to create a new one but we use the old one and 
locate ourselves on the location of the old command.If we could make the shell 
running in this way, when we carry out a same command,we could get to the 
location of the command(the old one) and we could carry out the commands we 
very often do near the old one with only a few presses of 'up' or 'down' 
arrow.I am sure that most of us will always work more efficiently in this way. 
 I am sorry again for my poor expressing and if it take any confuse and 
misunderstanding to you,I feel very sorry.
 I am looking forward for your mail.
 Wish you happy!


   yours


 donglongchao


  2008.5.25
 P.S:I am using UBUNTU 8.04 for desktop,but I have some problem.Maybe it is a 
bug,so whom should I write mail to slove or express it? Would you please give 
me an advice? Thank you.
 
 
 
在2008-05-18,"Eric Blake" <[EMAIL PROTECTED]> 写道:
>-BEGIN PGP SIGNED MESSAGE-
>Hash: SHA1
>
>According to donglongchao on 5/16/2008 11:28 PM:
>|  We could put the current point to the location of the command which is
>just executed by us,so that we could find the near commands we need
>immediately,and don not need to press the key of 'up' or 'down' many many
>times.
>
>The 'reverse-search-history' readline command, bound by default to
>control-r, seems like the perfect fit for what you are describing - a
>shortcut for rapidly searching through only the commands that contain a
>particular substring, rather than having to cycle through every single
>recent command with the 'up' and 'down' arrows.
>
>- --
>Don't work too hard, make some time for fun as well!
>
>Eric Blake [EMAIL PROTECTED]
>-BEGIN PGP SIGNATURE-
>Version: GnuPG v1.4.9 (Cygwin)
>Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
>iEYEARECAAYFAkgvLDoACgkQ84KuGfSFAYDL7gCgqB0iXfbCKQ8HRv97ezmUjCpd
>mBMAoJePRYKldzQ5w/4/4ndOvU1WOmlu
>=/M+2
>-END PGP SIGNATURE-


Command can't be executed after "history abc"

2008-05-27 Thread chuli
Hi,
For bash-3.1 and bash-3.2, I write a script a.sh like this:
Test(){
history abc
echo "FAIL"
}
Test

Execute "bash a.sh", and "FAIL" can't be printed. Why should 'history' be 
designed like this?
I think it's better to continue execute the next command even if history is 
fail. 
(it seems "history abc" will use "get_numeric_arg"  which calls  
"jump_top_level", so "echo FAIL" can't be executed)

Regards
Chu Li






Re: Re: A wonderful idea about shell!

2008-05-27 Thread Bob Proulx
[EMAIL PROTECTED] wrote:
>  My real meaning in my last mail is that when we carry out a
>  command exactly in a second time ,in fact we could not need
>  to create a new one but we use the old one and locate
>  ourselves on the location of the old command.If we could
>  make the shell running in this way, when we carry out a
>  same command,we could get to the location of the
>  command(the old one) and we could carry out the commands we
>  very often do near the old one with only a few presses of
>  'up' or 'down' arrow.

Try this.  Try using Control-r to search backward in history for your
command.  Then try using Control-o to Operate on the line and to get
the next line.

  $ echo one
  $ echo two
  $ echo three
  ... type in control-r to start the search then "one" to locate it ...
  (reverse-i-search)`one': echo one
  ... type in control-o to operate on it and get the next line ...
  $ echo two
  ... type in control-o to operate on it and get the next line ...
  $ echo three

The bash documentation for the says:

   operate-and-get-next (C-o)
  Accept the current line for execution and fetch the next
  line relative to the current line from the history for
  editing.

Bob