Posts

Showing posts with the label Environment Variables

Can One Use Environment Variables In Inno Setup Scripts?

Answer : I ran into the same problem when trying to specify the source location of files in the [Files] section. I used the GetEnv function to define a new constant. #define Qt5 GetEnv('QT5') [Files] Source: {#Qt5}\bin\Qt5Concurrent.dll; DestDir: {app}; According to this page in the Inno Setup documentation, the value of environment variables can be retrieved using the following syntax: {%name|default} On install-time If you need to resolve the variable on the target machine, while installing, you can use the {%NAME|DefaultValue} "constant". [Files] Source: "MyApp.dat"; Dest: "{%MYAPP_DATA_PATH|{app}}" If you need to resolve the variable on the target machine in Pascal Script code, you can use GetEnv support function. Path := GetEnv('MYAPP_DATA_PATH'); On compile-time If you need to resolve the variable on the source machine, while compiling the installer, you can use GetEnv preprocessor function: [Files] Sourc...

Add Android-studio/bin/ To PATH Environmental Variable

Answer : It looks like you edited this code snippet: if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi which is included in ~/.profile by default. The answer which lead you to do so is confusing IMNSHO. I'd suggest that you change that code back to what it looked like before, and instead add a new line underneath it: if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi PATH="$PATH:/usr/local/Android/android-studio/bin" Then, next time you log in, PATH ought to be altered, whether $HOME/bin exists or not.

Can I Export A Variable To The Environment From A Bash Script Without Sourcing It?

Answer : Is there any way to access to the $VAR by just executing export.bash without sourcing it ? Quick answer: No. But there are several possible workarounds. The most obvious one, which you've already mentioned, is to use source or . to execute the script in the context of the calling shell: $ cat set-vars1.sh export FOO=BAR $ . set-vars1.sh $ echo $FOO BAR Another way is to have the script, rather than setting an environment variable, print commands that will set the environment variable: $ cat set-vars2.sh #!/bin/bash echo export FOO=BAR $ eval "$(./set-vars2.sh)" $ echo "$FOO" BAR A third approach is to have a script that sets your environment variable(s) internally and then invokes a specified command with that environment: $ cat set-vars3.sh #!/bin/bash export FOO=BAR exec "$@" $ ./set-vars3.sh printenv | grep FOO FOO=BAR This last approach can be quite useful, though it's inconvenient for interactive use sin...