0

I am very new to the bashshell and unix. I am proficient with Java and I know a bit of C, so bash and scripting is very new to me.

I am trying to modify the .profile in my home profile to have it echo my name every time I log on - however I encountered a situation. It is missing. I have checked for the hidden files in my directory using ls - a but it isn't there.

So do I just create a .profile file? I know that there is a /etc/profile that is given to me by my administrator but I am not allowed to overwrite that file.

Also, what would I include in the .profile file if I make my own? Would it just be as simple as creating the file and adding an echo statement with it accessing my username? I have tried this, and it failed.

Here is what my current script looks like(that fails):

PATH=/usr/bin:/usr/lbin:$HOME/bin:.:

export PATH
echo "My user profile has executed. Greetings!"

I'd like to add I'm not sure if this PATH is showing the correct path either - it is what I copied from my book.

1
  • Thanks. That helped - Off topic but do you have any resources to learn bash in general? I've looked at TLDP and I foudn it really hard to follow through. I didn't like how the book was laid out - it felt like they were throwing information all at once. I really like the format of C ansi 2nd edition by Brian and Ritchie. Concise explanations with examples and exercises. Hope that's not inappropriate to ask in the comments. Feb 4, 2017 at 16:00

1 Answer 1

0

Yes, you can simply create your own copy of .profile in your home directory.

However, you should also make sure that the code you want to add actually belongs there and not in .bashrc.

Maybe read What is the difference between .profile and .bash_profile and why don't I have a .profile file on my system?

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