Hi,
Maybe I should just make a break and go through this again by myself, but there is no more coffee, so there is no break for me ;)
I want to check for a given dir, exit with a message if it exists, or create the given dir otherwise.
What happens is, that the shell executes the && Branch and wont exit afterwards but executes the || branch, too. Obviously mkdir throws an ugly error when the directory exists.
Dont get me wrong, I know how to make it work with the usual if construct, but I cant sleep well tonight, when I dont use a one-liner :D
[[ -d ${DIR_CUSTOMER} ]] && (echo "*** Information: Directory ${DIR_CUSTOMER} already exists!"; exit 1;) || (echo "*** Creating ${DIR_CUSTOMER}"; mkdir ${DIR_CUSTOMER};)
^^ do YOU see where I made a mistake?
hugs,
schbrongx