i don't understand why simple read doesn't work. mind you, new bash. :)
#!/bin/bash echo -n "project name: " read project_name if [ -n "$project_name" ]; echo "you must provide project name." exit 2 fi -- snip -- when executes, asks project name. after press enter, "you must provide project name." , scripts exists instead of continuing.
what doing wrong?
thanks eric
you want [ -z "$project_name" ], not -n:
from man test:
-n string length of string nonzero ...
-z string length of string 0
Comments
Post a Comment