我正在尝试复制一个文件:〜/ .ssh /但每次我运行脚本时都会说
pi@raspberrypi:/etc/greenwich $ ./copybash.sh
cat: ~/.ssh/testfilegen2.log: No such file or directory
Run Code Online (Sandbox Code Playgroud)
copybash.sh
!/bin/bash
sourceFile="~/.ssh/testfilegen2.log"
targetFile="/etc/network/interfaces2"
sudo cat "$sourceFile" > "$targetFile"
sudo service networking restart
Run Code Online (Sandbox Code Playgroud)
有什么建议?
谢谢