Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sh history?

0 views
Skip to first unread message

Robert Fagen

unread,
Oct 5, 1995, 3:00:00 AM10/5/95
to

I'm using sh (I've not had a chance to install another one), and I can't
find in the man pages or in the source (only a cursory glance through)
where the shell command history is stored. Am I spoiled with AIX at work
in that it goes in a file called '.sh_history'? Is there a similar
file in FreeBSD?

Thanks,

Rob
--
------------------------------------------------------------------------
Rob Fagen | | #include <clever.sig>
voice 415-432-8101 | I only represent myself | #include <witty.quote>

J Wunsch

unread,
Oct 7, 1995, 3:00:00 AM10/7/95
to
Robert Fagen <imgi...@netcom.com> wrote:
>
>I'm using sh (I've not had a chance to install another one), and I can't

(You've already got another one: csh. It _can_ store the .history
file on logout, it does even have filename completion built in, but
perhaps not the kind of arrow-key-friendly history you're looking
for... :)

>find in the man pages or in the source (only a cursory glance through)
>where the shell command history is stored. Am I spoiled with AIX at work
>in that it goes in a file called '.sh_history'? Is there a similar
>file in FreeBSD?

A simple ``strings /bin/sh | fgrep hist'' (boys, where did'ya learn
unix?) leads to the conclusion that there's no such thing.
--
cheers, J"org

joerg_...@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

Robert Fagen

unread,
Oct 8, 1995, 3:00:00 AM10/8/95
to
J Wunsch (j...@uriah.heep.sax.de) wrote:
: A simple ``strings /bin/sh | fgrep hist'' (boys, where did'ya learn

: unix?) leads to the conclusion that there's no such thing.
: --
: cheers, J"org

: joerg_...@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
: Never trust an operating system you don't have sources for. ;-)

^^^^^^^
But why do it simply if I could follow your original advice instead?
-- biiiiig ;) --

Jonathan Chen

unread,
Oct 10, 1995, 3:00:00 AM10/10/95
to
In <imgidataD...@netcom.com> imgi...@netcom.com (Robert Fagen) writes:


>I'm using sh (I've not had a chance to install another one), and I can't

>find in the man pages or in the source (only a cursory glance through)
>where the shell command history is stored. Am I spoiled with AIX at work
>in that it goes in a file called '.sh_history'? Is there a similar
>file in FreeBSD?

Plain "sh" is minimal. No history, command line expansion, programmable
commands, aliases etc. That's the way it's always been. Other shells that
will provide what you want: csh, tcsh, bash, ksh, zsh, whatever. Take
your pick..
--
#!/bin/perl -s-- -export-a-crypto-system-sig -RSA-3-lines-PERL
$m=unpack(H.$w,$m."\0"x$w),$_=`echo "16do$w 2+4Oi0$d*-^1[d2%Sa
2/d0<X+d*La1=z\U$n%0]SX$k"[$m*]\EszlXx++p|dc`,s/^.|\W//g,print
pack('H*',$_)while read(STDIN,$m,($w=2*$d-1+length($n)&~1)/2)

J Wunsch

unread,
Oct 10, 1995, 3:00:00 AM10/10/95
to
Jonathan Chen <jo...@pinnacle.co.nz> wrote:

>>I'm using sh (I've not had a chance to install another one), ...

>Plain "sh" is minimal. No history, command line expansion, programmable
>commands, aliases etc.

Sheesh! Do you actually verify your assumptions before posting? I'm
not sure what you mean with "programmable commands", but perhaps
simple shell functions? Ok, except of file name expansion, you can
get everything else with a plain /bin/sh:


j@uriah 98% sh
$ ls
env nouucico
esrv0-uriah.heep.sax.de ps2term
esrv107-uriah.heep.sax.de rrn.5530
...
$ alias ls="ls -F"
$ ls
env nouucico
esrv0-uriah.heep.sax.de= ps2term/
esrv107-uriah.heep.sax.de= rrn.5530
...
$ set -o emacs
$ ls ## i've actually hit the up arrow key twice here!
env nouucico
esrv0-uriah.heep.sax.de= ps2term/
esrv107-uriah.heep.sax.de= rrn.5530
...
$ unalias ls
$ ls ()
> {
> echo *
> }
$ ls
env esrv0-uriah.heep.sax.de esrv107-uriah.heep.sax.de est.4501 et\
c.tar log_mg.cuaa1 mcom mmc-r01.ps nouucico ps2term rrn.5530 rrna\
ct.5530 sys_i386_isa uu xxx
$ ^D
j@uriah 99%

Faried Nawaz

unread,
Oct 11, 1995, 3:00:00 AM10/11/95
to
In article <45cdmn$i...@tui.pinnacle.co.nz> jo...@pinnacle.co.nz (Jonathan Chen) writes:

$ Plain "sh" is minimal. No history, command line expansion, programmable
$ commands, aliases etc. That's the way it's always been. Other shells that
$ will provide what you want: csh, tcsh, bash, ksh, zsh, whatever. Take
$ your pick..

I disagree -- /bin/sh on my machine (-current) can do aliases and has
(minimal) history functions (doesn't save to a file, though).

; /bin/sh
$ alias foo=oof
$ foo
oof: not found
$ exit
[status 2]
; clar
clar not found
[status 1]
; clear

; /bin/sh
$ pwd
/usr/home/fn
$ cd /tmp
$ ls -la
total 14
drwxrwxrwt 3 bin bin 512 Oct 11 13:59 .
drwxr-xr-x 18 root wheel 512 Oct 6 21:43 ..
-rw-rw---- 1 major bin 1610 Oct 11 13:59 resend.815.in
-rw-rw---- 1 major bin 1622 Oct 11 13:59 resend.815.out
drwxrwxrwx 3 fn bin 512 Oct 11 10:17 screens
$ set -o emacs
$ alias foo=oof
$ foo
oof: not found
$ fc r
fc: history pattern not found: r
$ exit
[status 2]
;

from the ports area, you can pick up ksh, zsh, bash, tcsh, rc and es (the
latter two from the plan9/ ports section).

i have found ksh and rc to be the shells that use the least resources on
my machine (i've compiled them staticly, and, in the case of rc, with
editline).


faried.

Chet Ramey

unread,
Oct 13, 1995, 3:00:00 AM10/13/95
to
In article <imgidataD...@netcom.com>,

Robert Fagen <imgi...@netcom.com> wrote:
>
>I'm using sh (I've not had a chance to install another one), and I can't
>find in the man pages or in the source (only a cursory glance through)
>where the shell command history is stored. Am I spoiled with AIX at work
>in that it goes in a file called '.sh_history'? Is there a similar
>file in FreeBSD?

The FreeBSD shell uses the 4.4 BSD `libedit' library to do history,
which keeps the history list in memory. It is not stored in a file.

Some shells store the command history in a file named by the shell
variable `HISTFILE' when an interactive shell exits (and read the
history from that file when an interactive shell starts) so it will
persist between shell sessions, but the FreeBSD shell appears not to
support that.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University Internet: ch...@po.CWRU.Edu

0 new messages