Bash

執行遠端 Bash 腳本 fin GitHub 失敗

  • November 17, 2021

我正在嘗試使用以下 curl 在我的 RaspberryPi 3 模型 B+ 上執行 bash 腳本:

export GITHUB_TOKEN=<my_personal_access_token>

curl -sSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/inmarsat-enterprise/fieldedge-core/main/install.sh | bash 

我也嘗試過從sudo apt install dos2unix另一個執行緒做一個,但這也因命令而失敗:

curl -sSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/inmarsat-enterprise/fieldedge-core/main/install.sh | dos2unix |bash 

bash 腳本“install.sh”包含使用者提示,它在第一個腳本中吐出,但我不知道如何解決這個問題?

任何人都可以幫忙嗎?

我在 Pi 上看到的錯誤:

pi@fieldedge:~ $ curl -sSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/inmarsat-enterprise/fieldedge-core/main/install.sh |dos2unix | bash
[FieldEdge INFO] Starting FieldEdge setup...
[FieldEdge INFO] Using GITHUB_TOKEN for secure file access.
[FieldEdge INFO] Updating host system. This may take several minutes...
Hit:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:2 http://archive.raspberrypi.org/debian bullseye InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Continue script installation?
1) Yes
2) No
#? 1) Yes
2) No
#? #? #? #? 1) Yes
2) No
1) Yes
#? #?
pi@fieldedge:~ $

我不知道問題是什麼,因為沒有明顯的錯誤,但一個簡單的解決方法是將腳本下載到文件中,然後執行該文件而不是使用管道:

curl -sSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/inmarsat-enterprise/fieldedge-core/main/install.sh > install.sh
bash ./install.sh

引用自:https://unix.stackexchange.com/questions/677944