I am using pdl2 shell, how can I list all my commands history?
You can find your history in $HOME/.perldl_hist
This may or may not be dependent on having Term::ReadLine::Gnu installed (which I have by default).
If you want access to your history within pdl
, then just use the up arrow key for the previous commands, or type ^R (control-r) then a text that you want to search back for (hitting ^r repeatedly for matches further back).
$ pdl
perlDL shell v1.354
...blah blah blah...
pdl> print 1+1
2
pdl> print 2+2
4
pdl> quit
$ cat ~/.perldl_hist
print 1+1
print 2+2
$
EDIT: To find the history from within pdl
, do the following:
$ pdl
pdl> print join "\n", $PERLDL::TERM->GetHistory
The $PERLDL::TERM->GetHistory
returns an array of the current history. It's just a regular array, so you can do whatever you like with it. For example, to find all of your recent histogram operations involving a piddle named mypdl
, you could do:
pdl> print join "\n", grep { /histogram/ && /mypdl/ } $PERLDL::TERM->GetHistory