Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.