Hi All,
I am trying to save history in FreeBSD 14.2 sh terminal because it does not appear to be saving history across sessions. Below is the code and resulting .profile file
Shell:
.profile file:
However, still the terminal does not record the command history.
Thanks & Best Regards
AMJS
I am trying to save history in FreeBSD 14.2 sh terminal because it does not appear to be saving history across sessions. Below is the code and resulting .profile file
Code:
# Save sh terminal command history
echo 'HISTFILE=~/.sh_history' >> /home/michael/.profile
echo 'HISTSIZE=1000' >> /home/michael/.profile
echo 'trap "history -a" EXIT' >> /home/michael/.profile
echo 'history -r "$HISTFILE"' >> /home/michael/.profile
chown michael:michael /home/michael/.profile
Shell:
Code:
michael@cs:~ $ echo $SHELL
/bin/sh
Code:
#
# .profile - Bourne Shell startup script for login shells
#
# see also sh(1), environ(7).
#
# These are normally set through /etc/login.conf. You may override them here
# if wanted.
# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH
# Setting TERM is normally done through /etc/ttys. Do only override
# if you're sure that you'll never log in via telnet or xterm or a
# serial line.
# TERM=xterm; export TERM
EDITOR=vi; export EDITOR
PAGER=less; export PAGER
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV
# Let sh(1) know it's at home, despite /home being a symlink.
if [ "$PWD" != "$HOME" ] && [ "$PWD" -ef "$HOME" ] ; then cd ; fi
# Query terminal size; useful for serial lines.
if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi
# Display a random cookie on each login.
if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune freebsd-tips ; fi
HISTFILE=~/.sh_history
HISTSIZE=1000
trap "history -a" EXIT
history -r "$HISTFILE"
However, still the terminal does not record the command history.
Thanks & Best Regards
AMJS