On 10-05-18 10:27 AM, Chaitanya Yanamadala wrote:
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..
You need to learn more about how bash(1) works.
bash(1) expands '~' to the user's home directory. To get Perl to do
this, use glob(); see `perldoc -f glob`.
To copy one file to another, use File::Copy; see `perldoc File::Copy`.
use File::Copy;
copy( glob( '~/.bash_history' ), \*STDOUT );
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
Eliminate software piracy: use only FLOSS.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/