1

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

MadHatter
  • 79,770
  • 20
  • 184
  • 232
Kyle Hudson
  • 202
  • 2
  • 11

1 Answers1

4

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.

MadHatter
  • 79,770
  • 20
  • 184
  • 232
  • 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 02 '10 at 15:14