Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an shell file with the following contents:

#!/bin/sh
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 support@securetrading.com < /usr/local/xpay4/email.txt

I get the following 2 errors:

./auto_xpay.sh: line 19: cp: command not found

./auto_xpay.sh: line 21: mutt: command not found

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

Thanks

share|improve this question
add comment

1 Answer

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
2  
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
add comment

Your Answer

 
discard

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.