Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a small shell script thats gets triggerd by another script via ssh.


if [ -z $1 ]
echo "Missing DB Name!"
exit 1

createdb -U postgres -T mytemplate -O myuser $PROJECT_dev

The problem is that the createdb statement doesent sees the $PROJECT variable. It's always empty when the script gets called.

I have no idea why.

share|improve this question
up vote 0 down vote accepted

Use curly brackets to delimit your actual variable:

createdb -U postgres -T mytemplate -O myuser ${PROJECT}_dev

otherwise, bash thinks the whole "PROJECT_dev" is your variable.

share|improve this answer
Stupid mistake from my side, thanks! – Izac Apr 6 '12 at 16:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.