Max*_*x13 10 linux bash pipeline wget pipe
我想创建一个bash脚本,它必须使用wget并使用bash运行它的输出:
wget -q -O - http://pastebin.com/raw.php?i=VURksJnn | bash
Run Code Online (Sandbox Code Playgroud)
pastebin文件是一个测试脚本,但是这个命令显示:"未知命令"(可能是由于新行)和"意外的文件结束",我不知道为什么.
我错过了什么吗?
你的脚本有DOS行结尾.
如果将行结尾转换为Unix行结尾,它运行正常:
$ tr -d '\r' < raw.php\?i\=VURksJnn > script
$ cat script | bash
Test script
You're not root
End test
$
Run Code Online (Sandbox Code Playgroud)