hi,
system command is only used to run the command and check its success
based on the exit status.
system ( "history ") == 0 or die " failed";
if you want to capture the output of system command use
my $OUTPUT=`history`;
print $OUTPUT;
you can find more details at
perldoc -f system
--
Regards,
Mohan
On 18/05/10 15:48, Shawn H Corey wrote:
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 );
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/