I am trying to setup a OpenStack box to have a look at OpenStack Object Storage (Swift). Looking through the web I found this link;


I followed the instructions line by line but stuck on step 7 in the "Getting the code and setting up test environment" section.

When I execute ~/.bashrc I get;

line 6: return: can only 'return' from a function or sourced script. 

Below is the Line 6 extract from ~/.bashrc. My first reaction is to comment this line out, but I dont know what it does. Can anyone help?

#If not running interactively, dont't do anything
[ -z "$PS1" ] && return

I'm running Ubuntu 12.04 as a VM on Hyper-v if knowing that is useful.


It looks like you should "source" the script. That means running it like this:

. ~/.bashrc

It's effectively the same as typing all the command into the shell you are running it from and has the effect of changing the environment of the running shell (which doesn't happen if it's run as a sub-process).


That page is giving you bad advice. You should not put those lines in ~/.bashrc. Exports should be in ~/.profile only. The default ~/.profile already adds ~/bin to PATH (if ~/bin exists), so you don't need to repeat that one. Thus:

  1. Remove the lines you added to ~/.bashrc
  2. Add the line export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf to ~/.profile
  3. Log out and back in again (~/.profile is read when you log in)

See http://mywiki.wooledge.org/DotFiles for more.

  • Ok, that's a little frustrating. I appreciate the effort someone put into getting that tutorial up but just wish a little more attention was put into the details. I've run into another road block now, I can't get further than step 7 of "Setting up scripts for running Swift" and have no idea how to debug it. Are there any other tutorils for setting up a Swift demo box you'd recommend? – Timothy Jun 28 '12 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.