shell - How to prevent bash script from putting all output into one line? -


i have following bash script top_script.sh

#!/bin/bash # "usage: $0 jobname logfile" jobname=$1 logfile=$2 job_output=$($1 2>&1) echo ${job_output} >> "${logfile}" 

that supposed invoked this

top_script.sh script_to_run.sh log.txt 

if script_to_run.sh has multiple echo statements, e.g.

echo line 1 $0 echo line 2 $0 

then in log.txt is

line 1 script_to_run.sh line 2 script_to_run.sh 

i.e. output gets concatenated single line. suspect reason line #5 in first code block above. how can modify ensure separate echos print separate lines in log.txt?

not matters, in case wondering, top_script.sh gets generated automatically form config file.

echo "${job_output}" >> "${logfile}" 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -