![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
Capturing bash output without displaying STOUT in terminalby edimusrex (Monk) |
on Sep 08, 2016 at 15:53 UTC ( #1171405=perlquestion: print w/replies, xml ) | Need Help?? |
edimusrex has asked for the wisdom of the Perl Monks concerning the following question: I need to capture the output of a bash command in perl which I've done a million times but for some reason this specific issue is hanging me up. What I need to do it capture the output from a git fetch --tags command and parse the results. The issue is if I run the following code The output of the command is displayed in terminal (which is to be expected since I haven't redirected it). However, if I run the command as followed: The variable is empty (which is also expected because I am redirecting it to /dev/null). The only way I can get it to work is if I redirect to a file first as such: and then parsing the output file. I am trying to avoid having to do that if at all possible meaning I do not want an extra step of checking a tmp file, would much rather do it in one step. Help would be greatly appreciated. Thanks ********** UPDATE **********
Thanks again for all your suggestions.
Back to
Seekers of Perl Wisdom
|
|