-1
當我想在屏幕上顯示我的日曆時,腳本向我顯示有條件的錯誤 - 如果其他 - 但我不知道爲什麼;我想這應該沒問題。我的Bash代碼中發生了什麼?
# !/bin/bash
rm --f calen
mostrar = 0
echo "agrega un mes"
read mes
echo "agrega un año"
read year
echo "Agregar [1] para mostrar las dos primeras semanas, o [2] para mostrar las ultimas dos semanas"
read mostrar
if[$mostrar = 1] then
cal -m $mes $year >> calen
head -n 4 calen
else
cal -m $mes $year >> calen
head -n 2 calen
tail -n 3 calen
fi
你試過了嗎if [$ mostrar = 1];然後' - 用分號? – TessellatingHeckler
是的,但我不知道爲什麼如果更改,如果[$ mostrar = 1]工作 –
請給予更多有意義的主題,如「如果陳述不在bash中工作」 –