#!/bin/ksh/
SERVER_NAME=bcpstd.root.net
FOLDER_ROOT_PATH=/data/feed/daily
CURDATE=`date +"%Y%0m%0d"`
scp gfstd@${SERVER_NAME}:${FOLDER_ROOT_PATH}/details_all_data_${CURDATE}.dat.gz /local/FILE_UPLOADS/I_FILES/
当我运行这个时它会询问密码
bash-4.4$ sh data_load.sh
Password:
但是如果将相同的脚本全部转换为硬编码,它可以正常工作,不需要输入密码
#!/bin/ksh/
SERVER_NAME=bcpstd.root.net
FOLDER_ROOT_PATH=/data/feed/daily
CURDATE=`date +"%Y%0m%0d"`
scp [email protected]:/data/feed/daily/details_all_data_20231228.dat.gz /local/FILE_UPLOADS/I_FILES/
当我像上面那样硬编码运行它时,它工作正常
bash-4.4$ sh data_load.sh
details_all_data_20231228.dat.gz 100% 596MB 39.2MB/s 00:15