FAQ: Environment - Bash Profile

Hello. I’m stuck on the “Bash Profile” exercise. I was able to get past step 1 but I’m not able to get past step 2. What should I do differently? The message at the bottom keeps saying, “Did you use to create a greeting in the bash profile that begins with ?”

Same here, but I first wrote plain echo Mamma. Then I changed that to be echo “Mamma” which worked.
I tried on my computer, but this does not recognise nano at all.

Same here; i started out by moving back and forth between by computers’ gitbash and codeacademy - big mistake, i ended up with a 3 line welcome on my nano!
2nd, try not to overthink it. just type the exact steps (.ctr + o…). There needs to be much more explanation of what’s happening for this nano tool!

I had the same issue and as the error message was not clear it took me a while to figure it out! The issue for me was that when i opened nano is was typing nano ~/ .bash_profile but this did not open the correct file. It worked when i didn’t use a space between / and . (nano ~/.bash_profile)

2 Likes

Did you passed in the exercise of Bash Profile.?
I was getting some errors while submitting the step-2 of the BashProfile Exercise! :pensive: Please help me with this

Welcome to the forums!

What errors are you getting?

Greetings everyone. I just solved the problem for step number two. On step one you have to type
$ nano ~/.bash_profile. But on step two you have to write the same thing but everything has to be together. Don`t leave any spaces in between.

2 Likes

Hi Admin/Forum peers,

I ran into the same issue with task 3, step 2 - following the instructions exactly step by step would always prompt this error "Did you use to create a greeting in the bash profile that begins with ?"

Please kindly advise what to do as I really need to finish this command line stuff to brush up on it and get prepared for a job interview. Very frustrating at the moment as I have literally tried any other way and researched on google and none could solve this issue, which is apparently a bug. Thanks in advance.
@discourse-admin

1 Like

have you typed string starting with echo ?

Hi,

I have a question about step 2. In the end, it says:

Then, once you’ve exited nano and are back in the terminal, press the Enter (or return for Mac) key onto a new line.

Why do I need to press Enter here if the command prompt is already available for typing a new command?

1 Like

If I had to guess it’s probably to trigger some sort of background check which allows you to complete the task. It’s not a requirement of the shell itself.

1 Like

I think you’re right. At the same time, it would be nice to explain such things explicitly in the course itself. Anyway, thanks!

1 Like

You saved my life) It worked. it is almost a guessing situation instead of knowledge. What’s up w/that?

guys, rewrite without any space nano~/.bash_profile in step 2 terminal and THEN continue to echo “Welcome, Jane Doe” steps

  1. Why should I use bash profile?
    For example if I can use “nano hello.text” to edit edit and store file, why I have to use bash profile to edit and store?
  2. What is the deference between a bash profile and a normal text file, and What is the deference between a bash profile and a profile?

Hi,

nano is used to create files (such as a .txt file for text).

The Bash Profile is used to store environment settings.
You shouldn’t use it to store regular file content but instead information about what to do when bash runs.
For example, one of the exercises modifies the bash profile so a statement is written to the screen whenever the bash is loaded.

By ‘profile’, if you mean a .profile file, it acts similarly to the bash profile. However, as the Bash Profile is specific to bash only, you should use this to create commands for when bash starts.

Hope that explains the difference.

3 Likes

Thank you very much for answering! You explained the concepts very clear. It is really helpful!

1 Like

The work around solution that I discovered was to reset this entire section, not the exercise solely.

Go to the first slide > click Get Unstuck > click Reset Exercise

3 Likes

Hate the fact that this worked lol completely correct… just chance…not knowledge .-.

Was anyone able to get their bash profile actually print out anything when opening a new terminal?
I had to edit the .bashrc profile has well to get it t work, I did this in my separate ubuntu environment

1 Like

There’s a bit of an oddity there where OSX (and possibly a couple of others) make every new terminal use a login shell whereas a lot of the modern linux based systems don’t (the shells are interactive, but not log-in shells). Typically bash_profile is run once when you log in and anything put there is therefore available for any new subshells from then on (you can explicitly use a login shell with bash --login if you want). If you want something to be sourced every time you open a new shell then .bashrc is a better shout (works on both systems).

If you want a solution where you could copy the relevant bash configurations to any system (portable) then you might want to look at some stackoverflow/stackexchage and simiar Q&A websites for some better guidance.