http://www.perlmonks.org?node_id=812247


in reply to command line history?

Why don't I get any output for this?
You will get output if you use strict and warnings. Then, get more info with diagnostics. It won't be the output you want to get, but you will get warning messages.

Perhaps this does not work because history is a shell built-in command which is not in the PATH environment variable.

Update: As a potential workaround, it seems that some shells support a history file. Perhaps it is as simple as setting an environment variable (HISTFILE?) in your shell, then parsing that file inside your Perl code.

Replies are listed 'Best First'.
Re^2: command line history?
by vlsimpson (Beadle) on Dec 10, 2009 at 17:43 UTC

    You could read in the history file, e.g. .bash_history or whatever file for shell you're using.

Re^2: command line history?
by leocharre (Priest) on Dec 10, 2009 at 17:22 UTC
    Yah, but.. Why *doesn't* that output history? Does the environment perl runs under not have access to that? Very neat.