Hello.
I have this quick question about these files.
The name of these files have any consequence? I mean, if I use one instead of the other with the same code inside, do they run all the code, or the code being ran will depend on the name of the file?
Is it different to have the same content in one or the other file, or the same code will run in either of them?
I have all the above files and I'm not sure I can gather all the code in a single file and stick to it instead of having several files!
Thanks
Psy
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
.profile, .bash_profile, .bash_aliases, etc
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: .profile, .bash_profile, .bash_aliases, etc
I keep things simple and just use ~/.profile because that is read by all shells.
If you create ~/.bash_profile then bash won't read ~/.profile so you'll have to either source it or copy the contents over.
If you create ~/.bash_profile then bash won't read ~/.profile so you'll have to either source it or copy the contents over.
deadbang
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: .profile, .bash_profile, .bash_aliases, etc
Ok, an what happens in the background when you issue ???
Code: Select all
source file
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: .profile, .bash_profile, .bash_aliases, etc
From the bash man page:
Note that the source command is a bashism. To source files with other shells use the . ("dot") command instead (which will also work with bash): https://pubs.opengroup.org/onlinepubs/9 ... 2.html#dot
Code: Select all
source filename [arguments]
Read and execute commands from filename in the current shell en‐
vironment and return the exit status of the last command exe‐
cuted from filename. If filename does not contain a slash,
filenames in PATH are used to find the directory containing
filename. The file searched for in PATH need not be executable.
When bash is not in posix mode, the current directory is
searched if no file is found in PATH. If the sourcepath option
to the shopt builtin command is turned off, the PATH is not
searched. If any arguments are supplied, they become the posi‐
tional parameters when filename is executed. Otherwise the po‐
sitional parameters are unchanged. If the -T option is enabled,
source inherits any trap on DEBUG; if it is not, any DEBUG trap
string is saved and restored around the call to source, and
source unsets the DEBUG trap while it executes. If -T is not
set, and the sourced file changes the DEBUG trap, the new value
is retained when source completes. The return status is the
status of the last command exited within the script (0 if no
commands are executed), and false if filename is not found or
cannot be read.
deadbang
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time
Re: .profile, .bash_profile, .bash_aliases, etc
Ok, thank you.
So, if I copy contents from files .bash_profile, .bash_aliases all into .profile, I'll be good, right?
So, if I copy contents from files .bash_profile, .bash_aliases all into .profile, I'll be good, right?
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
-
- Posts: 1405
- Joined: 2009-09-10 20:15
- Location: Saint-Petersburg, Russian Federation
- Been thanked: 11 times
Re: .profile, .bash_profile, .bash_aliases, etc
See "man bash", INVOCATION, to hear the these scripts calling order.
- PsySc0rpi0n
- Posts: 322
- Joined: 2012-10-24 13:54
- Location: Bitcoin World
- Has thanked: 8 times
- Been thanked: 1 time