Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Capture output from backtick commands using sudo

by Anonymous Monk
on Oct 03, 2013 at 15:55 UTC ( [id://1056769]=note: print w/replies, xml ) Need Help??


in reply to Re: Capture output from backtick commands using sudo
in thread Capture output from backtick commands using sudo

Hi, I stumbled across the same issue as you. In fact, since sudo will return: 'Upon successful execution of a program, the exit status from sudo will simply be the exit status of the program that was executed.' - you will not the the result of the 'ls'. In a specific case, what I wished for was the output of the executed program ('ls', for you). Did you find an answer for this? I'd really prefer not to use any temp files. Thanks! Norbert
  • Comment on Re^2: Capture output from backtick commands using sudo

Replies are listed 'Best First'.
Re^3: Capture output from backtick commands using sudo
by Happy-the-monk (Canon) on Oct 03, 2013 at 16:28 UTC

    Huh? Give perl -E 'say `sudo "/bin/ls"`' a try. The exit status is not the STDOUT of the programme, but it's "return code". Like: did the command succeed?

    Cheers, Sören

    Créateur des bugs mobiles - let loose once, run everywhere.
    (hooked on the Perl Programming language)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1056769]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-24 00:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found