if [ -z "${VAR}" ]; then
echo "VAR is unset or set to the empty string"
fi
if [ -z "${VAR+set}" ]; then
echo "VAR is unset"
fi
if [ -n "${VAR+set}" ]; then
echo "VAR is set, possibly to the empty string"
fi
if [ -n "${VAR+set}" ] && [ -z "${VAR}" ]; then
echo "VAR is set to the empty string"
fi
if [ -n "${VAR}" ]; then
echo "VAR is set to a non-empty string"
fi
'내밥줄 > 프로그래밍' 카테고리의 다른 글
[펌] [linux] AWK & SED chunk 2 (0) | 2013.05.16 |
---|---|
[펌]Can I do "make uninstall" with CMake? (0) | 2013.04.16 |
[펌]All about Variables in Bash | Shell Scripting (0) | 2013.01.23 |
쉘 스크립트 각종 trim 방법 (0) | 2013.01.22 |
[펌]메모리 누수 Valgrind로 막아 보자 (0) | 2012.10.24 |