Hi all,
I was wondering if someone could tell me which is the best command to use to run a unix command and to hide the error output from the shell. I'd also like to be able to tell if the command failed or not. What would be the best to use: backticks, system or exec?
BTW I also cross posted this over here: Perl Guru Forums: Perl Programming Help: Beginner: Unix command, hide error message
...
User Profile
Collapse
-
Unix command, hide error message
-
Thanks Kevin. I guess what initially lead me to think that I could improve the efficiency is whenever Im at the console and I do a grep it finds the information so quickly, even for big files. I guess if ran through the Perl interpreter this would be a lot slower? -
I'm going to paste my code and I was wondering if any of you guys can see where I can be more efficient. I know a lot of it is sloppy because I'm a Perl beginner and I went quickly through this. Any feedback would be much appreciated. Here is my code:
...Code:#!/usr/bin/perl -w use Cwd; use Time::Local; main(); sub partition { my $x = $testNames[$_[0]]; my $i = $_[0]Leave a comment:
-
I come across a line in the file, then I go search my sorted list of elements to see if it matches one of them.
KiSsZ...Leave a comment:
-
I have a list of items that I'm searching for in the big files and they are stored in an array and they are sorted. A binary search is when you first look at the middle value to compare with the value you're looking for, then if it's less you go to middle value of the left half of the array, if it's greater you go to the middle value of the right half of the array and you keep doing this till you find the value. With each comparison you eliminate...Leave a comment:
-
Program Performance
Hi,
I have a program that does the following: given a directory as it's only argument, it goes to that directory and looks for directories inside that contain 2 special types of very large files. If it finds these files, it goes through each file line by line looking to see if they contain certain strings. As mentioned, these two files are very big and contain a lot of information, and I recently ran this program on a certain directory... -
Sorry forgot to answer your question Jeff. I'm using F-secure SSH Client to log onto a linux machine.
KiSSLeave a comment:
-
I tried both of those, still no dice. Thanks for trying to help though. This is driving me nuts, the program works, I just want those ugly errors to go away.
KiSS...Leave a comment:
-
I tried that and the $out populated as it was supposed to. Also tried inserting $dir instead of $dir1/$file1 in the split line but the error message still shows. This is so weird.
KiSSLeave a comment:
-
Hi,
I tried doing:
and it still acted the same way. Thanks for trying though.Code:@temp = split(/\s+/, `du \–sk $dir1/$file1`);
KiSSaLeave a comment:
-
`du -sk $dir1/$file1` produces error
Hi all,
I'm having a problem with the following piece of code in one of my programs:
I'm getting the following error for each time the first line is called: "du: cannot access `\226sk': No such file or directory." Everything is working as it's supposed to, I'm getting the correct value for du -sk $dir1/$file1...Code:@temp = split(/\s+/, `du –sk $dir1/$file1`); push(@directorySizes, $temp[0]);
No activity results to display
Show More
Leave a comment: