Atish Deepank
Atish Deepank

Reputation: 17

storing output of history command in a text file

My script code is

history > a.txt

but this does not store anything in the text file. However when I use the command in prompt it works.

I am working with a KornShell (ksh) script on UNIX.

Upvotes: 1

Views: 2543

Answers (1)

P.P
P.P

Reputation: 121387

'history' command is disabled outside the command line (like your script). You can enable it using:

set -o history

Now the command 'history' will be available to your script.

Upvotes: 1

Related Questions