Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: command line history?

by toolic (Bishop)
on Dec 10, 2009 at 17:17 UTC ( #812247=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://812247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2020-05-28 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (165 votes). Check out past polls.

    Notices?