I want to return the value from a function called in a shell script. Perhaps I am missing the syntax. I tried using the global variables. But that is also not working. The c
You are working way too hard. Your entire script should be:
if mkdir "$lockdir" 2> /dev/null; then echo lock acquired else echo could not acquire lock >&2 fi
but even that is probably too verbose. I would code it:
mkdir "$lockdir" || exit 1
but the resulting error message is a bit obscure.