you're doing nothing wrong.
scp detects when it's writing to a tty or a pipe or file or whatnot
and suppresses that *********** line if writing to a pipe or file.
Try running script beforehand and close it after scp'ing the file.
It won't suppress displaying it on the screen, but it will capture everything that happens during the script session.
The following is a function that I use in a variety of my scripts to enable an SCP session within the process. It pulls its params in from a config file that is parsed elsewhere to provide to this function's call. You can swap in your own vars or even static values to get a sense of what it's doing.
SCP (or SSH, for that matter...) is not overly verbose, unless you specifically tell it to be. The terminal output you see when in the shell is not captured, most likely since it speaks to security anyway. Best bet might be to track the return code(s) and debug as needed in the case of problems. You can, however, modify the verbosity some by incrementing the verbosity switch/flag on your particular scp client. This is seen in the ${verbosity} parameter shown in the function's actual scp call:
###########################
# function SCP_mthd ...
# - process SCP transfer
function SCP_mthd
{
$_dbg_mode
print "\n\tGreetings from SCP_mthd ($@) " >>${MY_LOG} 2>&1
# Scrap it if there aren't sufficient params...
if [[ -z ${param_num1} ]] \
|| [[ -z ${param_num2} ]] \
|| [[ -z ${param_num3} ]] \
|| [[ -z ${param_num4} ]] \
|| [[ -z ${param_num5} ]] \
|| [[ -z ${param_num6} ]]
then
print "\n ===\n\n ${my_name}: $(date) " |tee -a ${MY_LOG}
print "\n ${0} called w/ invalid argument(s)... " |tee -a ${MY_LOG}
print "\n " |tee -a ${MY_LOG}
print "\n\tCalled as: $0 ${@} \n" \
"\tParameters: ${param_num1} \n " \
"\t [ -------- ] \n " \
"\t ${param_num3:-"#"} \n " \
"\t ${param_num4:-"#"} \n " \
"\t ${param_num5:-"#"} \n " \
"\t ${param_num6:-"#"} \n " \
|grep -v "#" |tee -a ${MY_LOG}
error_flag='Y' ; logger_heads ;return 2
fi
# Hereby reserving the param_num2 column for use as an alternate IdentityFile \
# in SSH-based calls (ie, -i "/..." for ssh/scp, -o "/..." for sftp, etc)
# - placing "not used" string within column in .cfg file will bypass \
# usage of alternate file
if [[ ! -z ${param_num2} ]] \
&& [[ ${param_num2} != "not_used" ]]
then
typeset host_pass=$(print ${param_num2} |tr "_" " " |tr "+" "-" )
fi
typeset -l host_name="${param_num3}"
typeset -l host_user="${param_num4}"
typeset host_dest="${param_num5}"
typeset locl_path="${my_file%/*[pf][rt][nm]}"
typeset locl_file="${my_file#${locl_path}/*}"
# print "host_name=${host_name}"
# print "host_user=${host_user}"
# print "host_pass=${host_pass}"
# print "host_dest=${host_dest}"
# print "locl_path=${locl_path}"
# print "locl_file=${locl_file}"
scp ${verbosity} ${host_pass} ${my_file} ${host_user}\@${host_name}\:${host_dest}\/\. \
>>${MY_LOG} 2>&1
rc=${?}
if [[ ${rc} != 0 ]]
then
print "\n ===\n\n ${my_name}: $(date) " |tee -a ${MY_LOG}
print "\n ${my_mthd} had an error... " |tee -a ${MY_LOG}
print "\n " |tee -a ${MY_LOG}
print "\n\tCalled as: $0 ${@} \n" \
"\tReturn Code: ${rc} \n " \ |tee -a ${MY_LOG}
error_flag='Y' ; logger_heads ;return 2
fi
echo "nicely done"
}