小编spb*_*pbr的帖子

Bash脚本 - 〜/ .ssh /中没有文件

我正在尝试复制一个文件:〜/ .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)

有什么建议?

谢谢

linux bash quoting tilde-expansion

0
推荐指数
1
解决办法
70
查看次数

标签 统计

bash ×1

linux ×1

quoting ×1

tilde-expansion ×1