Find the answer to your Linux question:
Results 1 to 6 of 6
hi. first, i'm quite new to linux. I would like to know if there is any custom files that is 'automatically supported' (ie .bash_aliases) by linux which i can create ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! chris81's Avatar
    Join Date
    Jan 2009
    Posts
    62

    [SOLVED] path in a custom file


    hi.

    first, i'm quite new to linux.

    I would like to know if there is any custom files that is 'automatically supported' (ie .bash_aliases) by linux which i can create and adds to following
    lines:

    PATH=$PATH
    export PATH:/new/path


    Thanks.
    By the way, this forum is quite fast!

  2. #2
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    path is stored in two files

    system wide : /etc/profile
    user spcific: ~/.bashrc

    The bash automatically interpret this file on login or each start of a terminal emulator. You can store your own paths , command aliases, and many things.
    This treated as a bash script so you can write sripts here too.

  3. #3
    Just Joined! chris81's Avatar
    Join Date
    Jan 2009
    Posts
    62
    hi

    i know about the ~/.bashrc. but what i want is to, as i'm new, preserve that file without modifing it at all. As i'm new, if i got some troubles with my os, i'll be sure that it doesn't came from modifiyng that file. Also, is problems surgeon all that i will have to do is to delete my custom file. This is way i was aking that question.

    Well, i guess i don't have any other options. In the .bashrc profile, is there any 'section' where i can put my custom command lines ?


    Thanks for reading/answering.
    I wish you to have a good day.

  4. #4
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    there are no sections, you can divide the file logically but no need to mark this.

    Feel free to use this file and if you screw up your user you can restore the file as root

  5. #5
    Just Joined! chris81's Avatar
    Join Date
    Jan 2009
    Posts
    62
    Okay.

    Thanks.

    I'm gonna try out those things.


    By the way, and just to confirm that i'm right, in the .bashrc:

    if [ -f ./.bash_aliases ];
    # somethings here
    fi

    is just a condition statement to check if the file exist, if so,
    execute # something here, right ?
    (notice that agreeing to the above question will makes me thinking that -f is equivalent to bash -f FILENAME.)

  6. #6
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    hi

    Linux has a command called test you can do tests with this command.
    In a shell script the "[ condition statement here ]" equivalent with "test condition statement here".
    You can check the options for test in man.

    I suggest you give full path in the condition , like ~/.bash_aliases instead of ./.bash_aliases.

    And yes if the condition true "#somethings here " will run.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •