Skip to main content
22 events
when toggle format what by license comment
Jan 17, 2022 at 6:34 comment added Silvio Levy export VARIABLE=value is perfecly fine in your .profile. It is recognized by all the Bourne-style shells mentioned by Matteo, as well as dash. The original Bourne shell itself may not accept this idiom, but why should you be limited in your scripts by the (lack of) features of a 45-year old program that you will not be using? (Nowadays /bin/sh is usually a symlink to either /bin/bash or /bin/dash, rather than the feature-poor Bourne shell.)
Dec 6, 2017 at 15:54 comment added Timo I use zsh. Will the .zprofile as describe above be read before .zshrc when login or when doing exec zsh?
Nov 8, 2017 at 21:09 history edited G-Man Says 'Reinstate Monica' CC BY-SA 3.0
Added quotes; other minor cleanup.
Sep 26, 2017 at 6:05 comment added Matteo @JoshNoe if it does not exist create it
Sep 25, 2017 at 23:11 comment added Josh Noe In Fedora: "/home/joshnoe/.profile: No such file or directory"
Jun 6, 2013 at 16:07 history edited Matteo CC BY-SA 3.0
Edited per comment
Jun 6, 2013 at 6:56 comment added tripleee Because .profile is read by all Bourne-compatible shells, you should not write Bash syntax in that file. In particular, export VARIABLE=value needs to be refactored into VARIABLE=value; export VARIABLE.
S Jun 6, 2013 at 6:08 history suggested Babu CC BY-SA 3.0
Added reference to bashrc
Jun 6, 2013 at 5:06 review Suggested edits
S Jun 6, 2013 at 6:08
Feb 20, 2013 at 16:32 history edited Matteo CC BY-SA 3.0
Minor formatting
Aug 2, 2012 at 22:56 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
mention and favor .profile; mention .zprofile for zsh
Sep 28, 2011 at 11:56 history edited rozcietrzewiacz CC BY-SA 3.0
added 5 characters in body
Sep 28, 2011 at 11:55 comment added rozcietrzewiacz @acid this is what is should have done. The question is, what is sourced when you log in. To check that, log out first.
Sep 28, 2011 at 11:51 vote accept CommunityBot
Sep 28, 2011 at 11:51 comment added user4069 @Matteo ?. It returns me nothing. No error, no msg, nothing. Although if i write export VAR="val" at the end of .bash_profile which i had to create and use su - user i do get results :D
Sep 28, 2011 at 11:50 comment added rozcietrzewiacz Why did you su in the first place? Didn't you just create a root-owned .profile that cannot be used by the user?
Sep 28, 2011 at 11:45 comment added Matteo To check if your .bashrc (or .profile) is correct: source .bashrc. Is then the variable set?
Sep 28, 2011 at 11:44 comment added user4069 oh wow i didnt know that. Thanks @TimKennedy. However i still dont see the variable i set when using su - theuser :(
Sep 28, 2011 at 11:43 comment added Matteo Wait: what do you mean by "exited to root"? In any case making an 'su' does not initialize the shell. You need 'su -' (see man su)
Sep 28, 2011 at 11:35 comment added Tim Kennedy The default behavior of su user is to change ownership of the current shell to the username arg, while keeping the home directory and environment of the calling user. To enter a shell in such a way as to become the new user, and gain all of their environmental settings ( $PATH, $HOME, $ABC, etc) you need to pass a - as the first argument to su. su - username will accomplish what you are asking for.
Sep 28, 2011 at 11:20 comment added user4069 that was one of the things i tried. i stuck export ABC="123" at the end of ~/.profile right now, exit (to root) then su back into that user and it didnt work. I checked by writing env and echo $ABC -edit- i am using bash. But i think the shell is a softlink located at /bin/sh
Sep 28, 2011 at 11:15 history answered Matteo CC BY-SA 3.0