2
我已經將此腳本編寫爲安裝postgres中的模塊,這是爲了向用戶顯示數據庫已創建並獲取他/她的輸入,因爲他們看到數據庫是創建。當我運行該腳本,我得到的錯誤line [:missing`]'請調試幫助
./dbtest: line 39: [: missing `]'
我已經嘗試添加「」周圍是和'周圍是,我無法弄清楚什麼是失蹤。腳本如下
#
#
# Check to make sure the database was created and who is the owner
#
#
if [ -f showdb ];
then
cp showdb /home
else
echo " show database file is missing "
fi
if [ -f /home/showdb ];
then
su - postgres -c '/home/showdb'
echo " Do you see the data name created listed above? "
echo " "
echo " Type yes or no (type out the whole word please) "
echo " "
read dbawr
if [ $dbawr == yes && $dbawr == Yes ];
then
echo "Great!"
exit
else
echo " Please contact tech support "
pause " Press [CTRL] [Z] to exit the program now "
fi
else
echo " File Missing!!"
fi
我在這個腳本中丟失了什麼?
謝謝!
但是,您可以使用'test'自己的邏輯選項。 '[this = this -a that = that]' – ghoti
好的一點,並且一個嚴格的答案應該包括那個。但是,我(和[許多其他人](https://wiki.ubuntu.com/DashAsBinSh#A.5B))通常更傾向於將其視爲單獨的測試,而不是用'-a'和'-o'分隔開,特別是因爲測試變得更加複雜。 雖然不錯,但;) –