2014-09-18 48 views
0

所以我有一個腳本(代碼如下),我得到以下錯誤。在iOS上的新行附近出現Bash語法錯誤

錯誤:

Syntax error near unexpected token newline (line 5) 

解決此錯誤代碼是

Sbalert -t "Updating" -m "Downloading and installing the update. Please don't touch your device until it reboots" -d "" & 
alert_id="$!" 
apt-get install --only-upgrade <Whited00r 7.1 OTA> 
reboot 

這爲一個iPod使用bash所以它可能是直接在桌面上的有所不同作了...如果有另一種方式來更新一個特定的包裝,這將是不錯的...

+0

堆棧溢出的語法突出顯示可能會回答你的問題:看起來你錯過了「string2」後的一個結束雙引號 – 2014-09-18 19:22:00

+0

這就是整個腳本......只是沒有shebang我會編輯它以反映代碼更多... – iTechy 2014-09-18 19:25:54

回答

2

考慮這條線:

apt-get install --only-upgrade <Whited00r 7.1 OTA> 

<>字符是特殊的外殼。他們告訴它執行輸入和輸出重定向。 shell在每個文件後都需要一個文件名。由於您將>放在行末,因此shell正在抱怨。

如果包被命名爲Whited00r 7.1 OTA,那麼你就需要運行這個命令:

apt-get install --only-upgrade "Whited00r 7.1 OTA" 

但是,我不知道如果這實際上是你可以安裝一個軟件包的名稱。

+0

這是一個錯字。更新了代碼來修復它。對不起。 – iTechy 2014-09-18 19:23:17

+0

@ itechy21這是正確的答案,該行的'部分不正確。您正在嘗試安裝的軟件包? – 2014-09-18 20:00:22

+0

我使用[link](http://askubuntu.com/questions/44122/how-to-upgrade-a-single-package-using-apt-get)獲取使用什麼 – iTechy 2014-09-18 20:14:54