Commits

Ches Martin committed 5b392a8

bash: More guards

Comments (0)

Files changed (1)

 # Just source this to set the ENV vars.
 # Set AWS_CREDENTIAL_FILE in ~/.local
 
-export EC2_PRIVATE_KEY="$(/bin/ls $HOME/.ec2/pk-*.pem)"
-export EC2_CERT="$(/bin/ls $HOME/.ec2/cert-*.pem)"
+if [ -f ~/.ec2/pk-*.pem ]; then
+    export EC2_PRIVATE_KEY="$(/bin/ls $HOME/.ec2/pk-*.pem)"
+fi
 
-if [ "$(uname -s)" == "Darwin" ]; then
+if [ -f ~/.ec2/pk-*.pem ]; then
+    export EC2_CERT="$(/bin/ls $HOME/.ec2/cert-*.pem)"
+fi
+
+if [[ "$(uname -s)" = "Darwin" ]]; then
     export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
     export AWS_IAM_HOME="/usr/local/Cellar/aws-iam-tools/HEAD/jars"
     export AWS_CLOUDWATCH_HOME="/usr/local/Library/LinkedKegs/cloud-watch/jars"