Arc*_*ing 4 command-line download wget curl
考虑这些wget代码:
wget -P ~/ https://raw.githubusercontent.com/user/repo/branch/papj.sh
wget -P ~/ https://raw.githubusercontent.com/user/repo/branch/nixta.sh
Run Code Online (Sandbox Code Playgroud)
有没有什么优雅的方法可以将具有上述相同基本 URL 的不同终端合并为一行而不是 2 行或更多行?
伪代码:
wget -P ~/ https://raw.githubusercontent.com/user/repo/branch/papj.sh||nixta.sh
Run Code Online (Sandbox Code Playgroud)
由于wget一次接受多个 URL,这可以使用括号扩展来完成bash:
wget -P ~/ https://raw.githubusercontent.com/user/repo/branch/{papj.sh,nixta.sh}
Run Code Online (Sandbox Code Playgroud)
(甚至
wget -P ~/ https://raw.githubusercontent.com/user/repo/branch/{papj,nixta}.sh
Run Code Online (Sandbox Code Playgroud)
但这当然仅适用于非常合适的名称)。