Ubuntu – Fc built in missing from dash ( i.e.,dash shell history doesn’t work )

command linedash-shell

In dash manual, under Builtins section there exists explanation on fc built in which controls shell history and re-executes commands from it, FCEDIT and HISTSIZE also are mentioned there. Yet when I try to execute it dash gives command not found error.

$ echo one
$ fc -l 1
dash: 2: fc: not found
$ fc
dash: 3: fc: not found

Question is, why ? Is it one of the standard and conscious choices that Ubuntu developers made or I may need to enable fc somehow ?

I have found Debian bug report that mentions fc, but the patch mentioned there is for i386 and last activity on the report has been in 2008, so nothing regarding Ubuntu so far. And historically, fc has had fixes and exists in versions for different BSD releases, so there's gotta be something Ubuntu-specific or Debian-specific here.

Best Answer

  • Check line number 57-59 in src/builtins.def.in of the dash source code:

    #ifndef SMALL
    histcmd     -u fc

    SMALL is defined if --with-libedit is not set in configure, which is the case for our dash/sh. I guess it's about optimzing the memory footprint.

    Also Changelog says:

    2005-10-29  Herbert Xu <herbert@gondor.apana.org.au>
    * Disable histcmd completely when SMALL is defined.

    If not compiling with --with-libedit was a deliberate choice or not is beyond my knowledge.