0

I'm a user of Ubuntu 12.04 LTS and in a future a user of Ubuntu 14.04 LTS.

I have a problem, when I run Ubuntu my .bashrc script doesn't work unless I open the terminal.

This is a problem because, for example, the paths I write doesn't work unless I execute the programs from the terminal.

Are there an user config startup file for Ubuntu and not for the terminal?

P.D.:Maybe I don't explain very well, in other words, I'd like to execute mi scripts on Ubuntu startup without using the terminal.

Jain Rach
  • 4,069
  • 1
  • 16
  • 25

3 Answers3

3

Shell initialisation files (.profile, .bashrc, etc.) are intended for preparing the user's (interactive) environment.

For standalone scripts, it's better to make them independent from the environment, including $HOME, $PATH, etc.

If you need to share code (functions, configuration) with other scripts, store that in a separate shell library that you source from a known location, either through a fixed path or from a path relative to the script's own location.

Henk Langeveld
  • 8,088
  • 1
  • 43
  • 57
1

you can add the line below at the start of your script file

source ~/.bashrc
leo108
  • 817
  • 5
  • 12
1
grep '/etc/bashrc' ~/.bashrc
if [ -f /etc/bashrc ]; then
      . /etc/bashrc   # --> Read /etc/bashrc, if present.

by default /etc/bashrc gets loaded when opening a console.

What are you trying to do - if you want to do something without it being executed as part of a console and more to do with system startup ? then you need to look into modifying existing service or adding a new service.

If this is related to when users ssh or connect it via console then its be bashrc file

V H
  • 8,382
  • 2
  • 28
  • 48