Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Misc
Reload this Page .BASHRC FILE help needed
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Misc Any questions or Linux discussion that does not fit in any of the other technical areas.

Reply
 
Thread Tools Display Modes
Old 05-07-2008   #1 (permalink)
papadam
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.............
papadam is offline   Reply With Quote
Old 05-07-2008   #2 (permalink)
bigtomrodney
Bigtomrodinator
 
bigtomrodney's Avatar
 
Join Date: Nov 2004
Location: Sunny South-East of Ireland
Posts: 4,927
Is that the whole file? It's only 98 lines long.
bigtomrodney is offline   Reply With Quote
Old 05-07-2008   #3 (permalink)
ennoil
Just Joined!
 
Join Date: Dec 2006
Posts: 47
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
__________________
The only time Microsoft will make a product that doesn't suck is when they make vacuum cleaners...
ennoil is offline   Reply With Quote
Old 05-07-2008   #4 (permalink)
i92guboj
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 926
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.
i92guboj is offline   Reply With Quote
Old 05-08-2008   #5 (permalink)
papadam
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.
papadam is offline   Reply With Quote
Old 05-08-2008   #6 (permalink)
i92guboj
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 926
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.

Quote:
Ok i got one answer that is

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

Quote:
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.

Quote:
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.
i92guboj is offline   Reply With Quote
Old 05-08-2008   #7 (permalink)
papadam
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!
papadam is offline   Reply With Quote
Old 05-10-2008   #8 (permalink)
scm
Linux Engineer
 
Join Date: Feb 2005
Posts: 965
Another common cause of premature end of file messages (IME) is a missing quote, which can be hard to find!
scm is offline   Reply With Quote
Old 05-10-2008   #9 (permalink)
i92guboj
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 926
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.
i92guboj is offline   Reply With Quote
Old 05-13-2008   #10 (permalink)
papadam
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.
papadam is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 08:19 PM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0