[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [BusyBox] Arith in ash
From:       Erik Andersen <andersen () lineo ! com>
Date:       2001-06-28 10:32:58
[Download RAW message or body]

On Thu Jun 28, 2001 at 07:33:49PM +0400, Vladimir N. Oleynik wrote:
> Erik,
> 
> > > Also, command line editing and history is a great feature. Take a look
> > > at hetio.c in a recent Debian version of ash. This code allegedly adds
> > > less than 3k to an i386 binary. Actually, wait a few days before
> > > looking because I have an important patch to hetio.c pending ;-).
> > 
> > If you looks closely, the command line editing already in busybox is
> > _much_ better then the hetio stuff.  The only thing lacking is hooking
> > into the busybox cmdedit stuff to implement the fc builtin.
> 
> What is fc?

It is used to select a range of commands from the history, and can re-execute
specified commands with substitution.  


    [andersen@sage busybox]$ bash
    [andersen@sage busybox]$ help fc
    fc: fc [-e ename] [-nlr] [first] [last] or fc -s [pat=rep] [cmd]
	fc is used to list or edit and re-execute commands from the history list.
	FIRST and LAST can be numbers specifying the range, or FIRST can be a
	string, which means the most recent command beginning with that
	string.
	
	   -e ENAME selects which editor to use.  Default is FCEDIT, then EDITOR,
	      then vi.
	
	   -l means list lines instead of editing.
	   -n means no line numbers listed.
	   -r means reverse the order of the lines (making it newest listed first).
	
	With the `fc -s [pat=rep ...] [command]' format, the command is
	re-executed after the substitution OLD=NEW is performed.
	
	A useful alias to use with this is r='fc -s', so that typing `r cc'
	runs the last command beginning with `cc' and typing `r' re-executes
	the last command.

If we implement "fc" we should also implement the "history" builtin.

    [andersen@sage busybox]$ help history 
    history: history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...]
	Display the history list with line numbers.  Lines listed with
	with a `*' have been modified.  Argument of N says to list only
	the last N lines.  The `-c' option causes the history list to be
	cleared by deleting all of the entries.  The `-d' option deletes
	the history entry at offset OFFSET.  The `-w' option writes out the
	current history to the history file;  `-r' means to read the file and
	append the contents to the history list instead.  `-a' means
	to append history lines from this session to the history file.
	Argument `-n' means to read all history lines not already read
	from the history file and append them to the history list.  If
	FILENAME is given, then that is used as the history file else
	if $HISTFILE has a value, that is used, else ~/.bash_history.
	If the -s option is supplied, the non-option ARGs are appended to
	the history list as a single entry.  The -p option means to perform
	history expansion on each ARG and display the result, without storing
	anything in the history list.

 -Erik

--
Erik B. Andersen   email:  andersen@lineo.com
--This message was written using 73% post-consumer electrons--



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic