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

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 an shell file with the following contents:

echo "enter code hereecho "Enter the site name, followed by [ENTER]:"
read site_name

mkdir -p /usr/local/xpay4$site_name
cp /usr/local/xpay4/InitXpay4.jar /usr/local/xpay4$site_name/InitXpay4.jar

cd /usr/local/xpay4$site_name/

export PATH=.:/usr/java/jre1.6.0_16/bin
java -jar InitXpay4.jar

echo _
echo "To automatically send the request certificate to SecureTrading please remember the site alias"
read site_alias

cd /usr/local/xpay4$site_name/
cp $site_alias.req.pem /tmp/$site_alias.req.pem

mutt -s "Certificate Request" -a /tmp/$site_alias.req.pem < /usr/local/xpay4/email.txt

I get the following 2 errors:

./ line 19: cp: command not found

./ line 21: mutt: command not found

My question is how would i reset the path? or is this not the problem?


share|improve this question
up vote 4 down vote accepted

It is the problem, and you trashed it yourself with the line

export PATH=.:/usr/java/jre1.6.0_16/bin

Stop trashing it, and you should be fine. You might want to do

export PATH=${PATH}:/usr/java/jre1.6.0_16/bin:.

instead. I personally don't like having . in the PATH, but if you're sure you need it, leave it in.

share|improve this answer
Having . in the path in a shell script that might get run from any directory is not just a dislike, but downright dangerous. Especially at the front of the path. So I'd make you're advice there a little stronger! – mattdm Dec 2 '10 at 15:14
thank you, that sorted it +1 – Kyle Hudson Dec 2 '10 at 15:23

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.