I have been to trying to write some output to a CSV file using the method below in a shell script:
writeToResultFile()
{
resultFile="ShakeoutResult.csv"
msg=" $*"
echo "writing to resultFile..$msg"
echo $msg >> $resultFile
}
When I tried to call this method:
writeToResultFile "column1,column2,column3"
It works fine and was written to output file. But when I tried to call this method from another method such as:
doProcess()
{
writeToResultFile "data1,data2,data3"
}
Nothing is written to the output file. Stepping through, I know that writeToResultFile() is getting invoked and the param also is echoed in the console, but not getting appended to the output file.
Just to make sure: what do you use? Bash? Because it’s working:
The output will be (cat output.txt):