what is the echo command in perl?
Hey
I'm writing a perl script at the moment to check my users quotas. I have used bash scripts before, and would like to know the equivilent perl command to the bash "echo" command. The reason being that part of my code is to echo to the outcome of a command: Code:
echo "$(repquota -a)" > temp Thanks in advance. Hamish |
hey hamish,
u can use "print" or even echo itself. #!/usr/bin/perl -w my @array = `repquota -a`; foreach my $record(@array) { print "$record\n"; } that's it..!!! Cheers |
the system() functionis also helpful if you just need to run some commands.
system("echo $(repquota -a`"); it basically just inserts what is betweent he "" into a command line and enters it |
you can also use, printf("\n"); like what we do in C
|
firstly why are you doing
Quote:
Code:
repquota -a > temp you can't simply print the output of a command (I assume you mean calling a system command from perl?) you can use sytem which will print out anyway. if you want to save to a file you can use system Code:
system("repquota -a > temp") you can do operations line by line of the output: (this example will simply print output from find) Code:
|
hey
thanks for all the feedback guys. I now have it working. Cheers Hamish |
All times are GMT -5. The time now is 01:37 AM. |