我不是Bash專家,我很困惑爲什麼我的代碼無法工作。如何設置其值可能爲空的Bash變量?
隨着
od = `pip list --outdated | cut -d ' ' -f 1`; if [ ${#od} -eq 0 ]; then echo 'Up to date'; else echo 'Outdated stuff!'; echo pip install -U $od; fi
我得到
od: =: No such file or directory
od: =: Bad file descriptor
-bash: 0: command not found
-bash: [: -neq: unary operator expected
我在做什麼錯在這裏,當我嘗試設置測試的輸出爲過時的包的名字給一個變量列表?
http://shellcheck.net是一個有用的工具。 –
'foo = bar'與'foo = bar'完全不同。 –
@TomFenech:我的日子過去了! – orome