-bash: /home/oracle: is a directory

来源:互联网 发布:2016广告投放数据分析 编辑:程序博客网 时间:2024/05/29 13:02

安装oracle 11g过程中,创建oracle用户以及配置了.bash_profile文件后,退出oracle用户,然后重新su - oracle后出现:-bash: /home/oracle: is a directory

[pw@gg ~]$ su - oracle
Password: 
-bash: /home/oracle: is a directory

多次尝试切换到oracle均是如此,在google和baidu上搜索:-bash: /home/oracle: is a directory  ,情况均和我的不一样,未果。

分析原因,肯定是./bash_profile内环境变量哪里设置的不对导致的,以下为我的.bash_profile


[oracle@ydrh1 ~]$ vi .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


export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/opt/ogg
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
unset USERNAME
umask 022


alias 'sqlplus'='/usr/local/rlwrap/bin/rlwrap sqlplus'
alias 'rman'='/usr/local/rlwrap/bin/rlwrap rman'
alias 'ggsci'='/usr/local/rlwrap/bin/rlwrap /opt/ogg/ggsci'
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
".bash_profile" 30L, 1024C 已写入           


后来经发现在标红的~的位置有一行,也就是在vi命令模式,正常情况下光标是不能移动到红色~区域的,而现在能移动到那里,说明有问题,可能的原因是在编辑.bash_profile时格式上出现了点问题(因为我用SecureCRT工具登录的linux系统,字符集使用不对可导致vi时出现莫名其妙的情况)

解决:

[root@pw ~]# su - oracle

-bash: /home/oracle: is a directory

[oracle@pw ~]$ vi .bash_profile

命令模式下,将光标移动到红色~位置,用dd命令删除此行,然后:wq保存退出

[oracle@pw ~]$ exit

[root@pw ~]# su - oracle

[oracle@pw ~]$ 

现象消失了,问题解决了,从这事可以看出,导致的问题原因很微不足道,但有时候就总在微不足道的小问题上翻跟头,所以以后做事要细心了……

 

原文:http://blog.csdn.net/langkeziju/article/details/9369217

0 0
原创粉丝点击