backtick commands and stderr

A

Alexandru Popescu

Hi!

When executing a system op using the backtick method, the standard
output is caught and returned in the assigned variable:

output= `ls -Al`

I am wondering what happens with the standard error output? I have
written a script that executes well in the happy path scenario, but
for the case where the invoked system tool is writting to stderr I
have no idea how to trap that.

Any help and ideas are highly appreciated,

/alex
 
W

Wilson Bilkovich

Hi!

When executing a system op using the backtick method, the standard
output is caught and returned in the assigned variable:

output= `ls -Al`

I am wondering what happens with the standard error output? I have
written a script that executes well in the happy path scenario, but
for the case where the invoked system tool is writting to stderr I
have no idea how to trap that.

Any help and ideas are highly appreciated,

Since it's a system command, you can ask it to redirect stderr to stdout:

output = `ls -Al 2>&1`
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top