Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm creating a bash script of which will run on a cron, it's purpose is to backup a directory to Amazon S3 using the s3cmd command.

I get the following error when I run the script:

/usr/bin/env: python: Not a directory

When I comment out the s3cmd command the Python error disappears. When I run this command in the terminal it operates as usual.

For those wondering, here's my entire bash script:


# clutching at straws here
# export PATH=/usr/bin/python:$PATH

# get the start time

# set the log file output
NOW=$(date +"%m-%d-%Y")

# fire the s3cmd sync command
/usr/local/bin/s3cmd/s3cmd sync --exclude-from /root/.s3cmd-exclude /var/www/ s3://domain-backup-latest/ > $PATH


# output diagnostic information
echo "Backup information:"
echo "- Duration: $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
echo "- Log: $URL"


I noticed in this related question that the Python script has a different declaration at the top of the file, I guess I need something like this but I'm only really familiar with bash scripting at this stage.

share|improve this question
up vote 0 down vote accepted

Got it, I was setting the $PATH variable, should have known this was too generic, part of the s3cmd script (or dependancies) must be using that.

Lesson learnt.

share|improve this answer
You set the PATH variable to include the name of the executable. It should be the name of the directory which contains the executable. That's why you're getting "python: not a directory". – Dennis Williamson Apr 30 '14 at 1:48

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.