Guys,
In my company we use firebird and everytime we install it in a new computer we need to add the firebird's path. I'd like some help to create a shell script to add this value in this path.
Guys,
In my company we use firebird and everytime we install it in a new computer we need to add the firebird's path. I'd like some help to create a shell script to add this value in this path.
Hello thiago-gabriell,
Write the following one line shell script fit your needs (you don't need to specify an interpreter, nor to make the file executable) :
export PATH=$PATH:<custom_path>
Then source it in your shell :
. script.sh
Don't forget to edit one of the scripts executed at boot time, like ~/.bashrc
(Bash specific) or /etc/profile
for example.
Apologies for my previous answer; because of what I said about it only applying to the current session, I don't think it's what you need for your solution.
If I understand your needs correctly, you need to change the path variable permanently, and the change needs to be done per-computer. If that is correct, you need to change the registry value that contains the path variable. HKLM\System\CurrentControlSet\Control\SessionManager\Environment\Path There is also an HKCU version if you want it per-user. CU environment variables are stored in HKCU\Environment
You can still use a simple cmd file if you want, but you'd have to use the reg command to change the registry setting instead of the set command to set the variable for the current session. I think the following is the line you would want in the cmd file instead.
REG ADD HKLM\System\CurrentControlSet\Control\SessionManager\Environment /v Path /t REG_EXPAND_SZ /d "%path%;directoryToAdd"
Sorry for the second answer, but I cannot comment on your answer (which itself should have been a comment) with my level of reputation points.
You need to put quotes around that because there are spaces in it. In my solution, notice I have quotes around the path. Directories like "Program Files" will have a space which causes the command to get parsed differently, as if everything after the space was a separate argument to the command. Quoting it eliminates that.