我想写一个bash脚本来sshpass Windows并运行网络共享bat。问题是当我运行命令时
\\server_name\shared_folder\xx.bat
通过cmd可以,但是当我在shell脚本中编写它时,我收到了错误
bin / sh:server_nameshared_folderxx.bat:找不到命令
似乎我没有用正确的风格写出路径。
我应该在脚本中使用更多\
命令吗?就像这样?
\\\\server_name\\\shared_folder\\\xx.bat
代码:
copy_files(){
sshpass -p Sybase123 ssh -o StrictHostKeychecking=no root@$machine "\\server_name\shared_folder\xx.bat"
echo "-- Finished action on $machine!"
}
for machine in `cat $machine_file`
do
echo "$machine:"
copy_files $machine;
done