我是 Linux 新手。
最近我买了一个 VPS 来托管一个 Teamspeak 服务器。我运行的是 Ubuntu 14.04。一切正常,但我需要运行一个名为ts3recover.sh:
#! /usr/bin/env bash
# init
function pause(){
read -p "$*"
}
/usr/bin/clear
echo "This script replaces the serveradmin password to reenable access
to your server. Use this script at your own risk.
Feel free to improve or extend this script. Share your modifications
on teamspeak forums (http://forum.teamspeak.com). Thank you.
Press any key to continue or ctrl+c to cancel..."
pause
echo "Current serveradmin and crypted password:"
sqlite3 ts3server.sqlitedb <<SQL_1
.header ON
SELECT client_login_name, client_login_password
FROM clients
WHERE client_id='1';
SQL_1
sqlite3 ts3server.sqlitedb <<SQL_2
UPDATE clients
SET client_login_password = "r5oBZ3Z8s8IqjiEJ/k3o9dkSUgU="
WHERE client_id = "1";
SQL_2
echo "updated entry:"
sqlite3 ts3server.sqlitedb <<SQL_3
SELECT client_login_name, client_login_password
FROM clients
WHERE client_id='1';
SQL_3
echo "
Server Query Admin Acccount replaced
Password: ykN+zfqD
NOTE: This password has been copied from another database and is
not safe. Update it directly after logging into your query
console. Use the clientsetserverquerylogin command.
You can enter help clientsetserverquerylogin for details.
"
不幸的是,当我尝试执行它时,返回了此结果。
---@-----:/usr/local/teamspeak# ./ts3recover.sh
: No such file or directory
但
---@-----:/usr/local/teamspeak# file ts3recover.sh
ts3recover.sh: a /usr/bin/env bash\015 script, ASCII text executable, with CRLF line terminators
我搜索了有关此问题的信息,并安装了许多 32 位库(我想它们就是这么叫的),但无济于事!它无法运行!
任何帮助将不胜感激。 :)
答案1
您的 shell 脚本使用 Windows 行尾 (CR+LF)。您需要将其转换为 Unix 行尾 (LF),例如使用dos2unix。