ok is it so.. thank you so i think i can do one thing like open the file ~/.bash_history and then read the file.. actually i am trying this alternative.. but there is some error.. when i give it like
open(DAT, "~/.bash_history")or die("Cannot open file"); $raw_data=<DAT>; print $raw_data; i am getting an error like cannot open file.. i am presently running the script under the root user.. Chaitanya On Tue, May 18, 2010 at 7:54 PM, Bob McConnell <r...@cbord.com> wrote: > The Perl command opens a new instance of the shell, not the one you > called Perl from. The new instance has no history to report. > > Bob McConnell > > -----Original Message----- > From: Chaitanya Yanamadala [mailto:dr.virus.in...@gmail.com] > Sent: Tuesday, May 18, 2010 10:20 AM > To: Bob McConnell > Cc: beginners@perl.org > Subject: Re: help in perl script > > dear Bob > if my current shell does not have any history then how come i am getting > the history when i run the same in the terminal?? > from where i am getting this history. > > > Chaitanya > > > > > On Tue, May 18, 2010 at 7:03 PM, Bob McConnell <r...@cbord.com> wrote: > > > From: Chaitanya Yanamadala > > > > hai > > both of these didnt help me.. > > > > @kammen > > i can run the history command from the command line.. > > but not through the perl script.. > > i have tried ur choice but it also didnt work.. > > > > @shawn > > yes it didnt gave me any out put.. > > but i require to print the output.. > > so hw do i do it.. > > > > can some body help me on this.. > > > Not until you learn a little more about Unix shells. Your > command worked > perfectly, it just didn't output what you expected. The history > command > in bash returnes the command history of the current shell. Since > you > just opened it via the system call, it has no history, so it > returns an > empty string. That behavior is correct. > > Now, what are you actually looking for? > > Bob McConnell > > > >