JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 1: User Commands     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information

Preface

Introduction

User Commands

acctcom(1)

adb(1)

addbib(1)

admin(1)

alias(1)

allocate(1)

amt(1)

appcert(1)

apptrace(1)

apropos(1)

ar(1)

arch(1)

as(1)

asa(1)

at(1)

atq(1)

atrm(1)

audioconvert(1)

audioctl(1)

audioplay(1)

audiorecord(1)

audiotest(1)

auths(1)

auto_ef(1)

awk(1)

banner(1)

basename(1)

basename(1B)

batch(1)

bc(1)

bdiff(1)

bfs(1)

bg(1)

biff(1B)

break(1)

builtin(1)

cal(1)

calendar(1)

cancel(1)

case(1)

cat(1)

cd(1)

cdc(1)

cdrw(1)

chdir(1)

checkeq(1)

checknr(1)

chgrp(1)

chkey(1)

chmod(1)

chown(1)

chown(1B)

ckdate(1)

ckgid(1)

ckint(1)

ckitem(1)

ckkeywd(1)

ckpath(1)

ckrange(1)

ckstr(1)

cksum(1)

cktime(1)

ckuid(1)

ckyorn(1)

clear(1)

cmp(1)

col(1)

comb(1)

comm(1)

command(1)

compress(1)

continue(1)

cp(1)

cpio(1)

cpp(1)

cputrack(1)

crle(1)

crontab(1)

crypt(1)

csh(1)

csplit(1)

ct(1C)

ctags(1)

ctrun(1)

ctstat(1)

ctwatch(1)

cu(1C)

cut(1)

date(1)

dc(1)

deallocate(1)

decrypt(1)

delta(1)

deroff(1)

des(1)

df(1B)

dhcpinfo(1)

diff(1)

diff3(1)

diffmk(1)

digest(1)

digestp(1)

dircmp(1)

dirname(1)

dirs(1)

dis(1)

disable(1)

disown(1)

dispgid(1)

dispuid(1)

dos2unix(1)

download(1)

dpost(1)

du(1)

du(1B)

dump(1)

dumpcs(1)

dumpkeys(1)

echo(1)

echo(1B)

ed(1)

edit(1)

egrep(1)

eject(1)

elfdump(1)

elfedit(1)

elfsign(1)

elfwrap(1)

enable(1)

encrypt(1)

enhance(1)

env(1)

eqn(1)

errange(1)

errdate(1)

errgid(1)

errint(1)

erritem(1)

error(1)

errpath(1)

errstr(1)

errtime(1)

erruid(1)

erryorn(1)

eval(1)

ex(1)

exec(1)

exit(1)

expand(1)

export(1)

exportfs(1B)

expr(1)

expr(1B)

exstr(1)

factor(1)

false(1)

fastboot(1B)

fasthalt(1B)

fc(1)

fdformat(1)

fg(1)

fgrep(1)

file(1)

file(1B)

filebench(1)

filep(1)

filesync(1)

filofaxp(1)

find(1)

finger(1)

fmt(1)

fmtmsg(1)

fold(1)

for(1)

foreach(1)

franklinp(1)

from(1B)

ftp(1)

ftpcount(1)

ftpwho(1)

function(1)

gcore(1)

gencat(1)

geniconvtbl(1)

genmsg(1)

get(1)

getconf(1)

getfacl(1)

getlabel(1)

getopt(1)

getoptcvt(1)

getopts(1)

gettext(1)

gettxt(1)

getzonepath(1)

glob(1)

goto(1)

gprof(1)

grep(1)

groups(1)

groups(1B)

grpck(1B)

hash(1)

hashcheck(1)

hashmake(1)

hashstat(1)

head(1)

help(1)

helpdate(1)

helpgid(1)

helpint(1)

helpitem(1)

helppath(1)

helprange(1)

helpstr(1)

helptime(1)

helpuid(1)

helpyorn(1)

hist(1)

history(1)

hostid(1)

hostname(1)

i286(1)

i386(1)

i486(1)

i860(1)

iAPX286(1)

iconv(1)

idnconv(1)

if(1)

indxbib(1)

install(1B)

ipcrm(1)

ipcs(1)

isainfo(1)

isalist(1)

jobs(1)

join(1)

jsh(1)

kbd(1)

kdestroy(1)

keylogin(1)

keylogout(1)

kill(1)

kinit(1)

klist(1)

kmdb(1)

kmfcfg(1)

kpasswd(1)

krb5-config(1)

ksh(1)

ksh93(1)

ktutil(1)

lari(1)

last(1)

lastcomm(1)

ld(1)

ldap(1)

ldapadd(1)

ldapdelete(1)

ldaplist(1)

ldapmodify(1)

ldapmodrdn(1)

ldapsearch(1)

ldd(1)

ld.so.1(1)

let(1)

lex(1)

lgrpinfo(1)

limit(1)

line(1)

list_devices(1)

listusers(1)

llc2_autoconfig(1)

llc2_config(1)

llc2_stats(1)

ln(1)

ln(1B)

loadkeys(1)

locale(1)

localedef(1)

logger(1)

logger(1B)

login(1)

logname(1)

logout(1)

look(1)

lookbib(1)

lorder(1)

lp(1)

lpc(1B)

lpq(1B)

lpr(1B)

lprm(1B)

lpstat(1)

lptest(1B)

ls(1)

ls(1B)

m4(1)

mac(1)

mach(1)

machid(1)

madv.so.1(1)

mail(1)

Mail(1B)

mail(1B)

mailcompat(1)

mailp(1)

mailq(1)

mailstats(1)

mailx(1)

make(1S)

makekey(1)

man(1)

mconnect(1)

mcs(1)

mdb(1)

mesg(1)

mkdir(1)

mkmsgs(1)

mkstr(1B)

mktemp(1)

moe(1)

more(1)

mp(1)

mpss.so.1(1)

msgcc(1)

msgcpp(1)

msgcvt(1)

msgfmt(1)

msggen(1)

msgget(1)

mt(1)

mv(1)

nawk(1)

nc(1)

nca(1)

ncab2clf(1)

ncakmod(1)

neqn(1)

newform(1)

newgrp(1)

news(1)

newsp(1)

newtask(1)

nice(1)

nl(1)

nm(1)

nohup(1)

notify(1)

nroff(1)

od(1)

on(1)

onintr(1)

optisa(1)

pack(1)

page(1)

pagesize(1)

pargs(1)

passwd(1)

paste(1)

patch(1)

pathchk(1)

pax(1)

pcat(1)

pcred(1)

pdp11(1)

perl(1)

pfcsh(1)

pfexec(1)

pfiles(1)

pfksh(1)

pflags(1)

pfsh(1)

pg(1)

pgrep(1)

pkcs11_inspect(1)

pkginfo(1)

pkgmk(1)

pkgparam(1)

pkgproto(1)

pkgtrans(1)

pkill(1)

pklogin_finder(1)

pktool(1)

plabel(1)

pldd(1)

plgrp(1)

plimit(1)

pmadvise(1)

pmap(1)

popd(1)

postdaisy(1)

postdmd(1)

postio(1)

postmd(1)

postplot(1)

postprint(1)

postreverse(1)

posttek(1)

ppgsz(1)

ppriv(1)

pr(1)

praliases(1)

prctl(1)

preap(1)

prex(1)

print(1)

printenv(1B)

printf(1)

priocntl(1)

proc(1)

prof(1)

profiles(1)

projects(1)

prs(1)

prt(1)

prun(1)

ps(1)

ps(1B)

psig(1)

pstack(1)

pstop(1)

ptime(1)

ptree(1)

pushd(1)

pvs(1)

pwait(1)

pwd(1)

pwdx(1)

ranlib(1)

rcapstat(1)

rcp(1)

rdist(1)

read(1)

readonly(1)

red(1)

refer(1)

regcmp(1)

rehash(1)

remote_shell(1)

remsh(1)

renice(1)

repeat(1)

reset(1B)

return(1)

rev(1)

rksh(1)

rksh93(1)

rlogin(1)

rm(1)

rmail(1)

rmdel(1)

rmdir(1)

rmformat(1)

rmmount(1)

rmumount(1)

roffbib(1)

roles(1)

rpcgen(1)

rpm2cpio(1)

rsh(1)

runat(1)

rup(1)

rup(1C)

ruptime(1)

rusage(1B)

rusers(1)

rwho(1)

sact(1)

sar(1)

sccs(1)

sccs-admin(1)

sccs-cdc(1)

sccs-comb(1)

sccs-delta(1)

sccsdiff(1)

sccs-get(1)

sccs-help(1)

sccs-prs(1)

sccs-prt(1)

sccs-rmdel(1)

sccs-sact(1)

sccs-sccsdiff(1)

sccs-unget(1)

sccs-val(1)

scp(1)

script(1)

sdiff(1)

sed(1)

sed(1B)

select(1)

set(1)

setenv(1)

setfacl(1)

setlabel(1)

setpgrp(1)

settime(1)

sftp(1)

sh(1)

shcomp(1)

shell_builtins(1)

shift(1)

shutdown(1B)

size(1)

sleep(1)

smbutil(1)

snca(1)

soelim(1)

sort(1)

sortbib(1)

sotruss(1)

source(1)

sparc(1)

spell(1)

spellin(1)

split(1)

srchtxt(1)

ssh(1)

ssh-add(1)

ssh-agent(1)

ssh-http-proxy-connect(1)

ssh-keygen(1)

ssh-keyscan(1)

ssh-socks5-proxy-connect(1)

stop(1)

strchg(1)

strconf(1)

strings(1)

strip(1)

stty(1)

stty(1B)

sum(1)

sum(1B)

sun(1)

suspend(1)

svcprop(1)

svcs(1)

switch(1)

symorder(1)

sys-suspend(1)

sysV-make(1)

t300(1)

t300s(1)

t4014(1)

t450(1)

tabs(1)

tail(1)

talk(1)

tar(1)

tbl(1)

tcopy(1)

tee(1)

tek(1)

telnet(1)

test(1)

test(1B)

tftp(1)

time(1)

timemanp(1)

times(1)

timesysp(1)

timex(1)

tip(1)

tnfdump(1)

tnfxtract(1)

touch(1)

touch(1B)

tplot(1)

tput(1)

tr(1)

tr(1B)

trap(1)

troff(1)

true(1)

truss(1)

tset(1B)

tsort(1)

tty(1)

type(1)

typeset(1)

u370(1)

u3b(1)

u3b15(1)

u3b2(1)

u3b5(1)

ul(1)

ulimit(1)

umask(1)

unalias(1)

uname(1)

uncompress(1)

unexpand(1)

unget(1)

unhash(1)

unifdef(1)

uniq(1)

units(1)

unix2dos(1)

unlimit(1)

unpack(1)

unset(1)

unsetenv(1)

until(1)

uptime(1)

userattr(1)

users(1B)

uucp(1C)

uudecode(1C)

uuencode(1C)

uuglist(1C)

uulog(1C)

uuname(1C)

uupick(1C)

uustat(1C)

uuto(1C)

uux(1C)

vacation(1)

val(1)

valdate(1)

valgid(1)

valint(1)

valpath(1)

valrange(1)

valstr(1)

valtime(1)

valuid(1)

valyorn(1)

vax(1)

vc(1)

vedit(1)

ver(1)

vgrind(1)

vi(1)

view(1)

vipw(1B)

volcheck(1)

volrmmount(1)

w(1)

wait(1)

wc(1)

what(1)

whatis(1)

whence(1)

whereis(1B)

which(1)

while(1)

who(1)

whoami(1B)

whocalls(1)

whois(1)

write(1)

xargs(1)

xgettext(1)

xstr(1)

yacc(1)

yes(1)

ypcat(1)

ypmatch(1)

yppasswd(1)

ypwhich(1)

zcat(1)

zlogin(1)

zonename(1)

zonestat(1)

history

, fc

, hist

- process command history list

Synopsis

/usr/bin/fc [-r] [-e editor] [first [last]]
/usr/bin/fc -l [-nr] [first [last]]
/usr/bin/fc -s [old=new] [first]

csh

history [-hr] [n]

ksh

fc -e - [old=new] [command]
fc -s [old = new] [command]
fc [-e ename] [-nlr] [first [last]]

ksh93

hist [-lnprs] [-e editor][-N num][first[last]]

Description

/usr/bin/fc

The fc utility lists or edits and reexecutes, commands previously entered to an interactive sh.

The command history list references commands by number. The first number in the list is selected arbitrarily. The relationship of a number to its command does not change except when the user logs in and no other process is accessing the list, at which time the system can reset the numbering to start the oldest retained command at another number (usually 1). When the number reaches the value in HISTSIZE or 32767 (whichever is greater), the shell can wrap the numbers, starting the next command with a lower number (usually 1). However, despite this optional wrapping of numbers, fc maintains the time-ordering sequence of the commands. For example, if four commands in sequence are given the numbers 32 766, 32 767, 1 (wrapped), and 2 as they are executed, command 32 767 is considered the command previous to 1, even though its number is higher.

When commands are edited (when the -l option is not specified), the resulting lines is entered at the end of the history list and then reexecuted by sh. The fc command that caused the editing is not entered into the history list. If the editor returns a non-zero exit status, this suppresses the entry into the history list and the command reexecution. Any command-line variable assignments or redirection operators used with fc affects both the fc command itself as well as the command that results, for example:

fc -s -- -1 2>/dev/null

reinvokes the previous command, suppressing standard error for both fc and the previous command.

csh

Display the history list. If n is given, display only the n most recent events.

-r

Reverse the order of printout to be most recent first rather than oldest first.

-h

Display the history list without leading numbers. This is used to produce files suitable for sourcing using the -h option to the csh built-in command, source(1).

History Substitution:

History substitution allows you to use words from previous command lines in the command line you are typing. This simplifies spelling corrections and the repetition of complicated commands or arguments. Command lines are saved in the history list, the size of which is controlled by the history variable. The history shell variable can be set to the maximum number of command lines that is saved in the history file, that is:

set history = 200

allows the history list to keep track of the most recent 200 command lines. If not set, the C shell saves only the most recent command.

A history substitution begins with a ! (although you can change this with the histchars variable) and can occur anywhere on the command line; history substitutions do not nest. The ! can be escaped with \ to suppress its special meaning.

Input lines containing history substitutions are echoed on the terminal after being expanded, but before any other substitutions take place or the command gets executed.

Event Designators:

An event designator is a reference to a command line entry in the history list.

!

Start a history substitution, except when followed by a space character, tab, newline, = or (.

!!

Refer to the previous command. By itself, this substitution repeats the previous command.

!n

Refer to command line n.

!-n

Refer to the current command line minus n.

!str

Refer to the most recent command starting with str.

!?str?

Refer to the most recent command containing str.

!?str? additional

Refer to the most recent command containing str and append additional to that referenced command.

!{command} additional

Refer to the most recent command beginning with command and append additional to that referenced command.

^previous_word^replacement^

Repeat the previous command line replacing the string previous_word with the string replacement. This is equivalent to the history substitution:

Repeat the previous command line replacing the string previous_word with the string replacement. This is equivalent to the history substitution:

!:s/previous_word/replacement/.

To re-execute a specific previous command and make such a substitution, say, re-executing command #6:

!:6s/previous_word/replacement/.
Word Designators:

A `:' (colon) separates the event specification from the word designator. 2It can be omitted if the word designator begins with a ^, $, *, - or %. If the word is to be selected from the previous command, the second ! character can be omitted from the event specification. For instance, !!:1 and !:1 both refer to the first word of the previous command, while !!$ and !$ both refer to the last word in the previous command. Word designators include:

#

The entire command line typed so far.

0

The first input word (command).

n

The n'th argument.

^

The first argument, that is, 1.

$

The last argument.

%

The word matched by (the most recent) ?s search.

x-y

A range of words; -y abbreviates 0-y.

*

All the arguments, or a null value if there is just one word in the event.

x*

Abbreviates x-$.

x-

Like x* but omitting word $.

Modifiers:

After the optional word designator, you can add a sequence of one or more of the following modifiers, each preceded by a :.

h

Remove a trailing pathname component, leaving the head.

r

Remove a trailing suffix of the form `.xxx', leaving the basename.

e

Remove all but the suffix, leaving the extension.

s/oldchars/replacements/

Substitute replacements for oldchars. oldchars is a string that can contain embedded blank spaces, whereas previous_word in the event designator can not.

^oldchars^replacements^
t

Remove all leading pathname components, leaving the tail.

&

Repeat the previous substitution.

g

Apply the change to the first occurrence of a match in each word, by prefixing the above (for example, g&).

p

Print the new command but do not execute it.

q

Quote the substituted words, escaping further substitutions.

x

Like q, but break into words at each space character, tab or newline.

Unless preceded by a g, the modification is applied only to the first string that matches oldchars. An error results if no string matches.

The left-hand side of substitutions are not regular expressions, but character strings. Any character can be used as the delimiter in place of /. A backslash quotes the delimiter character. The character &, in the right hand side, is replaced by the text from the left-hand-side. The & can be quoted with a backslash. A null oldchars uses the previous string either from a oldchars or from a contextual scan string s from !?s. You can omit the rightmost delimiter if a newline immediately follows replacements; the rightmost ? in a context scan can similarly be omitted.

Without an event specification, a history reference refers either to the previous command, or to a previous history reference on the command line (if any).

ksh

Using fc, in the form of

fc -e - [old=new] [command],

or

fc -s [old=new] [command],

the command is re-executed after the substitution old=new is performed. If there is not a command argument, the most recent command typed at this terminal is executed.

Using fc in the form of

fc [-e ename] [-nlr ] [first [last]],

a range of commands from first to last is selected from the last HISTSIZE commands that were typed at the terminal. The arguments first and last can be specified as a number or as a string. A string is used to locate the most recent command starting with the given string. A negative number is used as an offset to the current command number. If the -l flag is selected, the commands are listed on standard output. Otherwise, the editor program -e name is invoked on a file containing these keyboard commands. If ename is not supplied, then the value of the variable FCEDIT (default /bin/ed) is used as the editor. When editing is complete, the edited command(s) is executed. If last is not specified, it is set to first. If first is not specified, the default is the previous command for editing and -16 for listing. The flag -r reverses the order of the commands and the flag -n suppresses command numbers when listing. (See ksh(1) for more about command line editing.)

HISTFILE

If this variable is set when the shell is invoked, then the value is the pathname of the file that is used to store the command history.

HISTSIZE

If this variable is set when the shell is invoked, then the number of previously entered commands that are accessible by this shell is greater than or equal to this number. The default is 128.

Command Re-entry:

The text of the last HISTSIZE (default 128) commands entered from a terminal device is saved in a history file. The file $HOME/.sh_history is used if the HISTFILE variable is not set or if the file it names is not writable. A shell can access the commands of all interactive shells which use the same named HISTFILE. The special command fc is used to list or edit a portion of this file. The portion of the file to be edited or listed can be selected by number or by giving the first character or characters of the command. A single command or range of commands can be specified. If you do not specify an editor program as an argument to fc then the value of the variable FCEDIT is used. If FCEDIT is not defined then /bin/ed is used. The edited command(s) is printed and re-executed upon leaving the editor. The editor name - is used to skip the editing phase and to re-execute the command. In this case a substitution parameter of the form old=new can be used to modify the command before execution. For example, if r is aliased to ´fc -e - ´ then typing `r bad=good c' re-executes the most recent command which starts with the letter c, replacing the first occurrence of the string bad with the string good.

Using the fc built-in command within a compound command causes the whole command to disappear from the history file.

ksh93

hist lists, edits, or re-executes commands previously entered into the current shell environment.

The command history list references commands by number. The first number in the list is selected arbitrarily. The relationship of a number to its command does not change during a login session. When the number reaches 32767 the number wraps around to 1 but maintains the ordering.

When the l option is not specified, and commands are edited, the resulting lines are entered at the end of the history list and then re-executed by the current shell. The hist command that caused the editing is not entered into the history list. If the editor returns a non-zero exit status, this suppresses the entry into the history list and the command re-execution. Command line variable assignments and redirections affect both the hist command and the commands that are re-executed.

first and last define the range of commands. Specify first and last as one of the following:

number

A positive number representing a command number. A + sign can precede number.

-number

A negative number representing a command that was executed number commands previously. For example, -1 is the previous command.

string

string indicates the most recently entered command that begins with string. string should not contain an =.

If first is omitted, the previous command is used, unless -l is specified, in which case it defaults to -16 and last defaults to -1.

If first is specified and last is omitted, then last defaults to first unless -l is specified in which case it defaults to -1.

If no editor is specified, then the editor specified by the HISTEDIT variable is used if set, or the FCEDIT variable is used if set, otherwise, ed is used.

Options

The following options are supported:

-e editor

Uses the editor named by editor to edit the commands. The editor string is a utility name, subject to search via the PATH variable. The value in the FCEDIT variable is used as a default when -e is not specified. If FCEDIT is null or unset, ed is used as the editor.

-l

(The letter ell.) Lists the commands rather than invoking an editor on them. The commands is written in the sequence indicated by the first and last operands, as affected by -r, with each command preceded by the command number.

-n

Suppresses command numbers when listing with -l.

-r

Reverses the order of the commands listed (with -l ) or edited (with neither -l nor -s).

-s

Re-executes the command without invoking an editor.

ksh93

ksh93 supports the following options:

-e editor

Specify the editor to use to edit the history command. A value of - for editor is equivalent to specifying the -s option.

-l

List the commands rather than editing and re-executing them.

-N num

Start at num commands back.

-n

Suppress the command numbers when the commands are listed.

-p

Write the result of history expansion for each operand to standard output. All other options are ignored.

-r

Reverse the order of the commands.

-s

Re-execute the command without invoking an editor. In this case an operand of the form old=new can be specified to change the first occurrence of the string old in the command to new before re-executing the command.

Operands

The following operands are supported:

first
last

Selects the commands to list or edit. The number of previous commands that can be accessed is determined by the value of the HISTSIZE variable. The value of first or last or both is one of the following:

[+]number

A positive number representing a command number. Command numbers can be displayed with the -l option.

-number

A negative decimal number representing the command that was executed number of commands previously. For example, -1 is the immediately previous command.

string

A string indicating the most recently entered command that begins with that string. If the old=new operand is not also specified with -s, the string form of the first operand cannot contain an embedded equal sign.

When the synopsis form with -s is used, if first is omitted, the previous command is used.

For the synopsis forms without -s :

  • If last is omitted, last defaults to the previous command when -l is specified; otherwise, it defaults to first.

  • If first and last are both omitted, the previous 16 commands is listed or the previous single command is edited (based on the -l option).

  • If first and last are both present, all of the commands from first to last is edited (without -l ) or listed (with -l). Editing multiple commands is accomplished by presenting to the editor all of the commands at one time, each command starting on a new line. If first represents a newer command than last, the commands is listed or edited in reverse sequence, equivalent to using -r. For example, the following commands on the first line are equivalent to the corresponding commands on the second:

    fc -r 10 20     fc    30 40 
    fc   20 10      fc -r 40 30
  • When a range of commands is used, it is not be an error to specify first or last values that are not in the history list. fc substitutes the value representing the oldest or newest command in the list, as appropriate. For example, if there are only ten commands in the history list, numbered 1 to 10:

    fc -l 
    fc 1 99

    lists and edits, respectively, all ten commands.

old=new

Replace the first occurrence of string old in the commands to be reexecuted by the string new.

OUTPUT

When the -l option is used to list commands, the format of each command in the list is as follows:

"%d\t%s\n", <line number>, <command>

If both the -l and -n options are specified, the format of each command is:

"\t%s\n", <command>

If the commandcommand consists of more than one line, the lines after the first are displayed as:

"\t%s\n", <continued-command>

Examples

Example 1 Using history and fc

             csh                                     ksh

% history                               $ fc -l
  1   cd /etc                             1   cd /etc
  2   vi passwd                           2   vi passwd
  3   date                                3   date
  4   cd                                  4   cd
  5   du .                                5   du .
  6   ls -t                               6   ls -t
  7   history                             7   fc -l

% !d                                    $ fc -e - d
  du .                                    du .
  262   ./SCCS                            262   ./SCCS
  336   .                                 336   .

% !da                                   $ fc -e - da
  Thu Jul 21 17:29:56 PDT 1994            Thu Jul 21 17:29:56 PDT 1994

%                                       $ alias \!='fc -e -'

% !!                                    $ !
  date                                    alias ='fc -e -'
  Thu Jul 21 17:29:56 PDT 1994

Environment Variables

See environ(5) for descriptions of the following environment variables that affect the execution of fc: LC_CTYPE, LC_MESSAGES, and NLSPATH.

FCEDIT

This variable, when expanded by the shell, determines the default value for the -e editor option's editor option-argument. If FCEDIT is null or unset, ed(1) is used as the editor.

HISTFILE

Determine a pathname naming a command history file. If the HISTFILE variable is not set, the shell can attempt to access or create a file .sh_history in the user's home directory. If the shell cannot obtain both read and write access to, or create, the history file, it uses an unspecified mechanism that allows the history to operate properly. (References to history ``file'' in this section are understood to mean this unspecified mechanism in such cases.) fc can choose to access this variable only when initializing the history file; this initialization occurs when fc or sh first attempt to retrieve entries from, or add entries to, the file, as the result of commands issued by the user, the file named by the ENV variable, or a system startup file such as /etc/profile. (The initialization process for the history file can be dependent on the system startup files, in that they can contain commands that effectively preempts the user's settings of HISTFILE and HISTSIZE. For example, function definition commands are recorded in the history file, unless the set -o nolog option is set. If the system administrator includes function definitions in some system startup file called before the ENV file, the history file is initialized before the user gets a chance to influence its characteristics.) The variable HISTFILE is accessed initially when the shell is invoked. Any changes to HISTFILE does not take effect until another shell is invoked.

HISTSIZE

Determine a decimal number representing the limit to the number of previous commands that are accessible. If this variable is unset, an unspecified default greater than or equal to 128 are used. The variable HISTSIZE is accessed initially when the shell is invoked. Any changes to HISTSIZE does not take effect until another shell is invoked.

Exit Status

The following exit values are returned:

0

Successful completion of the listing.

>0

An error occurred.

Otherwise, the exit status is that of the commands executed by fc or hist.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
SUNWcs

See Also

csh(1), ed(1), ksh(1), ksh93(1), set(1), sh(1), source(1), attributes(5), environ(5)