LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2011, 04:31 AM   #1
texasj
LQ Newbie
 
Registered: Feb 2011
Posts: 23

Rep: Reputation: 2
Question -bash: [root command not found


hi!
I am having redhat 5 linux machine running on my windwos x in vmware workstation. Today i was installing oracle software in redhat 5 after editing the bash profile for the oracle user i got the following messages

su - oracle
password:*****
-bash: [oracle: command not found

su - root
password:*****
-bash: [root: command not found

-----------------------------------------------
Here is my PATH variable output of root

echo $PATH
[root@texasj ~]/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

I am googling this issue for day!
can any expert solve this out?
 
Old 02-08-2011, 04:56 AM   #2
prodev05
Member
 
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
Try the below steps.

1.) cat /etc/shells // if bash is not listed inside this file, then you have to install it.
2.) whereis bash // if bash in not shown, then you have to install bash package.

also pl mention what correction you made in the bash profile.
 
1 members found this post helpful.
Old 02-08-2011, 05:01 AM   #3
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
I'm guessing that you over ride [ with something eles and bash can find it. Try it with space.
 
Old 02-08-2011, 05:03 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and Welcome to LinuxQuestions,

Bash is included in RedHat so most likely as pointed out by prodev05 you made some error in your changes in bash_profile for the oracle user. Please post what you changed/added in the bash_profile file.

Kind regards,

Eric
 
1 members found this post helpful.
Old 02-08-2011, 08:28 AM   #5
texasj
LQ Newbie
 
Registered: Feb 2011
Posts: 23

Original Poster
Rep: Reputation: 2
Question update of bash_profile

Quote:
Originally Posted by EricTRA View Post
Hello and Welcome to LinuxQuestions,

Bash is included in RedHat so most likely as pointed out by prodev05 you made some error in your changes in bash_profile for the oracle user. Please post what you changed/added in the bash_profile file.

Kind regards,

Eric
Thanks for your reply Eric
I have made the following changes in oracle user .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

#Oracle settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=SHRI; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_OWNER=oracle export ORACLE_OWNER
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORACLE_HOSTNAME=shri.oracle.com; export ORACLE_HOSTNAME
PATH=/usr/x11R6/bin:/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib; export CLASSPATH
NLS_DATE_FORMAT="yyyy-mm-dd:hh24:mi:ss"; export NLS_DATE_FORMAT


echo "ORACLE_SID = $ORACLE_SID"
echo "ORACLE_BASE = $ORACLE_BASE"
echo "ORACLE_HOME = $ORACLE_HOME"
echo "TNS_ADMIN = $TNS_ADMIN"
echo "ORACLE_HOSTNAME" = "ORACLE_HOSTNAME"
id -a


I hope you will solve this!!!!!!!!
 
Old 02-08-2011, 08:32 AM   #6
texasj
LQ Newbie
 
Registered: Feb 2011
Posts: 23

Original Poster
Rep: Reputation: 2
Question

Quote:
Originally Posted by prodev05 View Post
Try the below steps.

1.) cat /etc/shells // if bash is not listed inside this file, then you have to install it.
2.) whereis bash // if bash in not shown, then you have to install bash package.

also pl mention what correction you made in the bash profile.
As you suggested here is what is have edited in .bash_profile of oracle user

thanks in advance!

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

#Oracle settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=SHRI; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_OWNER=oracle export ORACLE_OWNER
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORACLE_HOSTNAME=shri.oracle.com; export ORACLE_HOSTNAME
PATH=/usr/x11R6/bin:/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib; export CLASSPATH
NLS_DATE_FORMAT="yyyy-mm-dd:hh24:mi:ss"; export NLS_DATE_FORMAT


echo "ORACLE_SID = $ORACLE_SID"
echo "ORACLE_BASE = $ORACLE_BASE"
echo "ORACLE_HOME = $ORACLE_HOME"
echo "TNS_ADMIN = $TNS_ADMIN"
echo "ORACLE_HOSTNAME" = "ORACLE_HOSTNAME"
id -a
 
Old 02-08-2011, 08:47 AM   #7
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,608

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Hi,

since the error occurs when you try to login as root as well as oracle, did you also change both user's .bash_profile and/or .bashrc? Or did you change a file in /etc?
To investigate further issue the following and post the result:
Code:
sudo find /etc/ -type f -iname 'bash*' -exec grep '\[\$USER' '{}' \;
sudo find /home/oracle/ /root/ -type f -iname '.bash*' -exec grep '\[\$USER' '{}' \;
If that does not return anything then try
Code:
sudo find /etc/ -type f -iname 'bash*' -exec grep '\[\$' '{}' \;
sudo find /home/oracle/ /root/ -type f -iname '.bash*' -exec grep '\[\$' '{}' \;
PS: Since RedHat includes paid support you should also consider to give RedHat a call.

Last edited by crts; 02-08-2011 at 08:48 AM.
 
Old 02-08-2011, 08:59 AM   #8
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
and /etc/profile
 
Old 02-08-2011, 09:03 AM   #9
texasj
LQ Newbie
 
Registered: Feb 2011
Posts: 23

Original Poster
Rep: Reputation: 2
Question unsolved

Quote:
Originally Posted by crts View Post
Hi,

since the error occurs when you try to login as root as well as oracle, did you also change both user's .bash_profile and/or .bashrc? Or did you change a file in /etc?
To investigate further issue the following and post the result:
Code:
sudo find /etc/ -type f -iname 'bash*' -exec grep '\[\$USER' '{}' \;
sudo find /home/oracle/ /root/ -type f -iname '.bash*' -exec grep '\[\$USER' '{}' \;
If that does not return anything then try
Code:
sudo find /etc/ -type f -iname 'bash*' -exec grep '\[\$' '{}' \;
sudo find /home/oracle/ /root/ -type f -iname '.bash*' -exec grep '\[\$' '{}' \;
PS: Since RedHat includes paid support you should also consider to give RedHat a call.

Thanks for your reply!

The not output was there for above 4 commands!

I forgot to mention that all my root and oracle commands are working fine but the
annoying error is repeating whenever i logged in as root or oracle user.
I tried log out and restart also but the error was still there!
Can this error affect my system or oracle software installation?

thanks for addressing my issue!
hope you will sort out this!
 
Old 02-08-2011, 09:11 AM   #10
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,608

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
... as mentioned by ozanbaba search also in /etc/profile
Code:
sudo find /etc/ -type f -iname '*profile*' -exec grep '\[\$' '{}' \;
Quote:
The not output was there for above 4 commands!
That is weird. At least for the last two commands I get some output on my system; but that is not RedHat.
 
Old 02-08-2011, 10:13 AM   #11
texasj
LQ Newbie
 
Registered: Feb 2011
Posts: 23

Original Poster
Rep: Reputation: 2
Smile you solved it............!!!!

Quote:
Originally Posted by crts View Post
... as mentioned by ozanbaba search also in /etc/profile
Code:
sudo find /etc/ -type f -iname '*profile*' -exec grep '\[\$' '{}' \;
That is weird. At least for the last two commands I get some output on my system; but that is not RedHat.

hey! that was my sleep of hand's
The not output was there for above 4 command!
no output was there for above 4 commands.

Finally you made it! great!

I ran the command as you suggested and find out that there was a syntax error in the
/etc/profile which was changed for the oracle user.

I edited the /etc/profile again and now the error is vanished...!

Thanks very much expert..!

There are very few people who really feel other's trouble!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
/bin/bash: root: command not found pridefc Red Hat 5 12-12-2006 08:09 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-28-2006 12:57 AM
root@localhost:~# xf86config -bash: xf86config: command not found klemen Slackware 17 01-06-2005 03:56 AM
bash: command not found jc80 Fedora 3 03-14-2004 04:11 PM


All times are GMT -5. The time now is 01:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration