Find the answer to your Linux question:
Results 1 to 10 of 10
# Generic $dotdir/bashrc # Engineering Services (ES) # ## # Things the user might wish to set. export USER_PATH USER_PATH="~/bin" export EDITOR EDITOR=vim # Preferred editor. export PRINTER PRINTER=lp # ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    14

    Question .BASHRC FILE help needed


    # Generic $dotdir/bashrc
    # Engineering Services (ES)
    #

    ##
    # Things the user might wish to set.
    export USER_PATH
    USER_PATH="~/bin"
    export EDITOR
    EDITOR=vim # Preferred editor.
    export PRINTER
    PRINTER=lp # Preferred printer.
    export NNTPSERVER
    NNTPSERVER=usenet.cisco.com # Preferred news server.
    #setenv TERM "xterm-color"
    #setenv CLICOLOR "true"
    #setenv LSCOLORS "exfxcxdxbxegedabagacad"
    ##
    # Should the full environment be set up even for non-interactive shells?
    # Probably not but here is a variable to control it.
    export FULLENV
    FULLENV=true # 'true' or 'false'

    ##
    # Should all paths (even NFS, which might hang) be set up at login?
    # The alias "fullpath" is available to setup your full path. It can
    # also be used to change your path by changing USER_PATH above.
    export FULLPATH
    FULLPATH=true # 'true' or 'false'

    ################################################## #########################
    # Everything above this line helps configure the environment.

    # This line should not be removed.
    #set dotdir="~/.files"; if ( -f $dotdir/sys_bashrc ) source $dotdir/sys_bashrc

    #if ( $FULLENV != "true" && $?prompt == 0 ) exit

    ################################################## #########################
    # Everything below this line is run for interactive shells.
    # If you wish the full environment even in non-interactive
    # shells set FULLENV above to 'true'.

    umask 022 # no write by group or other
    unset autologout # disable autologout
    set filec # enable filename completion
    set fignore=(.o) # don't complete .o files
    set history=128 # save last 128 commands
    set ignoreeof # disable ^D for logout
    set noclobber # disable redirect overwrite
    set notify # enable immediate job notify
    set prompt="${HOST}:\!> " # shell prompt format
    set cdpath =~ # where cd if dir unfound


    alias u="uncompress"
    alias t="tar -xvf"
    alias im="cd $AUTOTEST/local/images"
    alias et="cd $AUTOTEST/local/etc"
    alias ar="cd $AUTOTEST/local/archive/01-03"
    alias log="cd $AUTOTEST/local/logs"
    alias test="cd $AUTOTEST/local/tests/cat5k"
    alias c="clear"
    alias cls="clear"
    alias bd="cd syn_core/nmp/nmpflash/build"
    alias br="cd ../../../.."
    alias cftp="/users/XXXXX/tftp1"
    alias bftp="/users/XXXXX/tftp2"
    alias tree="cd /auto/c5ksw/XXXXX"
    alias cs="/users/XXXXX/mybin/findcs"
    #alias lftp="/users/XXXXX/tftp"
    #alias cftp="/users/XXXXX/tftp1"
    #alias nftp="/users/XXXXX/tftp2"
    alias gftp="/users/XXXXX/tftp"
    #
    # Build cscope files
    #
    alias csf='rm cscope.files; find . -name \*.\[ch\] -print | grep -v nmpboot | grep -v rommon >cscope.files'
    alias ws="cd /ws/XXXXX/"
    stty erase ^H
    set hostname=`uname -n`
    alias setprompt='set prompt="\\
    ${hostname}:${cwd}\\
    \! % "'
    alias cd='chdir \!* && setprompt'
    setprompt # sets the actual prompt
    source /sw/packages/ccache/current/bin/setup-ccache
    export SR_MGR_CONF_DIR
    SR_MGR_CONF_DIR=~XXXXX/bin


    if ( $?MAIL != 0 ) then
    set mail=( $MAIL ) # mail spool
    endif
    # Local Variables:
    # mode:shell-script
    # sh-shell:bash
    # End:













    I used this script for my .bashrc file btu it showed an error that

    bash: ./.bashrc: line 153: syntax error: unexpected end of file


    Could someone please help me regarding this.............

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,124
    Is that the whole file? It's only 98 lines long.

  3. #3
    Just Joined!
    Join Date
    Dec 2006
    Posts
    52
    2 things. First to answer your question, if tests end in fi not endif for bash. endif is a C shell syntax. Second, you need to set your environment before you export it:

    EDITOR=vim # Preferred editor.
    export EDITOR

    NOT:

    export EDITOR
    EDITOR=vim # Preferred editor.

    John

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    This bashrc is a mess. If you don't understand what it does, you probably don't need such a bashrc file.

    Why are you trying to do on first place?

    If you have a specific need or problem, just let us know and we can help to design a basic rc file to solve that. But just throwing a +150 lines script into your home without knowing what even it does is not a good idea at all.

  5. #5
    Just Joined!
    Join Date
    May 2008
    Posts
    14

    Cool Hi All

    Quote Originally Posted by i92guboj View Post
    This bashrc is a mess. If you don't understand what it does, you probably don't need such a bashrc file.

    Why are you trying to do on first place?

    If you have a specific need or problem, just let us know and we can help to design a basic rc file to solve that. But just throwing a +150 lines script into your home without knowing what even it does is not a good idea at all.

    Actually i never worked on BASH i always worked on CSH, So i was having a csh rc file and i tried converting it to .bashrc file.
    So i got the problem.
    And i know what this file does.
    And for the first reply ! "Mr. I am having 257 lines in bashrc file but some of the lines are not meant to be disclosed."
    I am working for Cisco and those lines were containing some paths some router ip addresses, Release numbers and so on.
    Sorry for that!
    So


    Ok i got one answer that is

    If ends with Fi.

    But i am not satisfied with the second answer that says :

    export is to be used after we set the value.
    Buddy it is working fine for me in both the cases.
    Don't know how?

    So do u think that "if" is the one who is making my file to give an error: Unexpected end of file?

    Ok thanks for your support, I am trying to resolve it.

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by papadam View Post
    Actually i never worked on BASH i always worked on CSH, So i was having a csh rc file and i tried converting it to .bashrc file.
    So i got the problem.
    And i know what this file does.
    Well, we did not know that.

    Ok i got one answer that is

    If ends with Fi.
    Yep. "man bash" is your friend.

    But i am not satisfied with the second answer that says :

    export is to be used after we set the value.
    Buddy it is working fine for me in both the cases.
    Don't know how?
    Actually, it's the same. Again, man bash. It's all crystal clear there:

    Quote Originally Posted by man bash
    export [-fn] [name[=word]] ...
    export -p
    The supplied names are marked for automatic export to the environment of
    subsequently executed commands. If the -f option is given, the names refer
    to functions. If no names are given, or if the -p option is supplied, a
    list of all names that are exported in this shell is printed. The -n option
    causes the export property to be removed from each name. If a variable name
    is followed by =word, the value of the variable is set to word. export
    returns an exit status of 0 unless an invalid option is encountered, one of
    the names is not a valid shell variable name, or -f is supplied with a name
    that is not a function.
    "export" itself doesn't export anything. It only "marks" vars, functions and the like, and the shell is the one that exports them when forking.

    So do u think that "if" is the one who is making my file to give an error: Unexpected end of file?
    Well, you have an unfinished construction, and the error says that the file is ending prematurely... so I'd say: yes.

  7. #7
    Just Joined!
    Join Date
    May 2008
    Posts
    14

    Thumbs up

    Quote Originally Posted by i92guboj View Post
    Well, you have an unfinished construction, and the error says that the file is ending prematurely... so I'd say: yes.
    Thanks buddy for your great support.
    I really appreciate that!

  8. #8
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Another common cause of premature end of file messages (IME) is a missing quote, which can be hard to find!

  9. #9
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by scm View Post
    Another common cause of premature end of file messages (IME) is a missing quote, which can be hard to find!
    Both problems are easier to solve if you use an editor which supports highlighting for bash shell syntax. And most do.

  10. #10
    Just Joined!
    Join Date
    May 2008
    Posts
    14
    Quote Originally Posted by i92guboj View Post
    Both problems are easier to solve if you use an editor which supports highlighting for bash shell syntax. And most do.
    no mine is not supporting that kinda facility.
    Neways thanks.

Posting Permissions

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