Bash Redirecting Output From Multiple Functions to A File -
i trying make script redirect output couple of functions file. here code looks like.
#!/bin/bash touch /var/log/test.log results=/var/log/test.log outputformat() { echo "this outputformat" >> results } outputparsefull() { echo "this outputparsefull" >> results outputformat; } outputparsefull;
after running this, /var/log/test.log created file blank. want file contain following
this outputparsefull
this outputformat
one line must each function. doing wrong here?
you're writing file named results
, not using filename in variable $results
.
echo "this outputparsefulll" >> results
should
echo "this outputparsefulll" >> $results
Comments
Post a Comment