Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Standard Unix streams, redirection and piping
  • How and why to direct script diagnostic messages to standard error, but function results to standard output
  • Argument defaulting
  • Automatically creating a log file for a script
  • Capturing standard output in a variable using backtick quoting

...

  • Starts automatic logging to a log file named using its 1st logFileTag argument.
  • Calls stdStreams with its 2nd and 3rd arguments.
  • Calls stdStreams again, but this time capturing its output in a local variable using backtick execution syntax, then displays the captured text.
  • Calls the echo_se function with some text.
  • Calls the echo_se function again, capturing its output in a local variable, then displays the captured text.

...

Expand
titleSolution

Because backtick execution evaluation creates a new execution environment, and only standard output is returned.

Why is the $output variable empty in segment 4) when echo_se "Some random text"is called with output being captured?

Expand
titleSolution

Because BecauseĀ backtick execution evaluation creates a new execution environment, and only standard output is returned.

...