Skip to content

Instantly share code, notes, and snippets.

@evgeni
Created March 8, 2013 19:26
Show Gist options
  • Save evgeni/5119091 to your computer and use it in GitHub Desktop.
Save evgeni/5119091 to your computer and use it in GitHub Desktop.
#!/bin/sh
# -n STRING
# the length of STRING is nonzero
foo=""
echo "expect: no output (syntax error)"
if [ -n "${foo}"]
then
echo "1. [ -n "${foo}"]"
fi
echo "expect: no output"
if [ -n "${foo}" ]
then
echo "2. [ -n "${foo}" ]"
fi
foo="true"
echo "expect: no output (syntax error)"
if [ -n "${foo}"]
then
echo "3. [ -n "${foo}"]"
fi
echo "expect: output"
if [ -n "${foo}" ]
then
echo "4. [ -n "${foo}" ]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment