I am trying to print a log using bash
that captures the some text, logged in user, date, and time and prints it to a file analysis
.
bash
echo "analysis done by" "$USER" "on" && date +"%D" && date +"%r" > /home/analysis
However, currently only the time prints to analysis and the echo
.... user and date print to stdout
. Why is this the case, am I doing something wrong? Thanks.
stdout
analysis done by cmccabe on
07/12/16
desired result (analysis)
analysis done by cmccabe on
07/12/16
08:31:32 AM