Skip to main content
deleted 18 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead:

  • add the variables in the script itself (where they don't need to be exported) or:, or
  • add them (and export them) in your personal .bashrc file, or:or
  • add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both) or:
  • add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script),.

Warning: If you add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), then the variables would not be available if you run the script from cron.

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead:

  • add the variables in the script itself (where they don't need to be exported) or:
  • add them (and export them) in your personal .bashrc file, or:
  • add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both) or:
  • add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script),

Warning: the variables would not be available if you run the script from cron.

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead:

  • add the variables in the script itself (where they don't need to be exported), or
  • add them (and export them) in your personal .bashrc file, or
  • add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both).

If you add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), then the variables would not be available if you run the script from cron.

Updated Answer
Source Link
Fabby
  • 5.5k
  • 2
  • 24
  • 38

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead add the variables (and export them) in your personal .bashrc file, alternatively in the script itself (where they don't need to be exported). Another solution might be to add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both).:

  • add the variables in the script itself (where they don't need to be exported) or:
  • add them (and export them) in your personal .bashrc file, or:
  • add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both) or:
  • add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script),

If you addWarning: the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), they would not be available if you run the script from cron.

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead add the variables (and export them) in your personal .bashrc file, alternatively in the script itself (where they don't need to be exported). Another solution might be to add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both).

If you add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), they would not be available if you run the script from cron.

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead:

  • add the variables in the script itself (where they don't need to be exported) or:
  • add them (and export them) in your personal .bashrc file, or:
  • add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both) or:
  • add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script),

Warning: the variables would not be available if you run the script from cron.

added 10 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead add the variables (and export them) in your personal .bashrc file, alternatively in the script itself (where they don't need to be exported). Another solution might be to add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is either started either by your terminal application, or by your graphical environment when you log in (or both).

If you add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), they would not be available if you run the script from cron.

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead add the variables (and export them) in your personal .bashrc file, alternatively in the script itself (where they don't need to be exported). Another solution might be to add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is either started by your terminal application, or by your graphical environment when you log in.

If you add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), they would not be available if you run the script from cron.

The variables in your /etc/bash.bashrc file are not exported. The file is read by any interactive non-login shell, but not by shell scripts (these are non-interactive).

Since the variables are not exported, they are not available in the environment of your script.

I would suggest not modifying the distribution-provided file /etc/bash.bashrc and instead add the variables (and export them) in your personal .bashrc file, alternatively in the script itself (where they don't need to be exported). Another solution might be to add them (and export them) in a separate .sh file under /etc/profile.d which would export the variables for any login shell. A login shell is started either by your terminal application, or by your graphical environment when you log in (or both).

If you add the variables anywhere other than in the script itself (in a file not explicitly sourced by the script), they would not be available if you run the script from cron.

added 113 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
added 184 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
added 158 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading