bash: #alias:找不到命令 ??

重复贴和参考价值不大的帖子,版主维护
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

bash: #alias:找不到命令 ??

#1

帖子 yilan198711 » 2008-12-28 22:48

每次打开终端就会有以下的一行提示现于首行

不知道是什么意思

能否解决下??

bash: #alias:找不到命令
mint+gnome
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#2

帖子 yilan198711 » 2008-12-29 12:45

自己顶上

求解中………………
mint+gnome
头像
HuntXu
论坛版主
帖子: 5778
注册时间: 2007-09-29 3:09
送出感谢: 0
接收感谢: 6 次

Re: bash: #alias:找不到命令 ??

#3

帖子 HuntXu » 2008-12-29 13:20

贴你的~/.bashrc和~/.bash_profile
HUNT Unfortunately No Talent...
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#4

帖子 yilan198711 » 2008-12-29 16:00

~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi


alias zhcon='zhcon --utf8 --drv=vga'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
alias ll='ls -l'



后者为空文件
mint+gnome
头像
HuntXu
论坛版主
帖子: 5778
注册时间: 2007-09-29 3:09
送出感谢: 0
接收感谢: 6 次

Re: bash: #alias:找不到命令 ??

#5

帖子 HuntXu » 2008-12-29 17:18

alias应该是shell builtin的命令
配置文件也没看出问题啊...
HUNT Unfortunately No Talent...
aerofox
帖子: 1453
注册时间: 2008-05-24 8:30
送出感谢: 2 次
接收感谢: 31 次

Re: bash: #alias:找不到命令 ??

#6

帖子 aerofox » 2008-12-29 22:11

提示的不是 alias 找不到,是 # alias 找不到。但 # 应该是开始一个注释的,不该报这个错误。如果上面贴的代码是直接 copy 过来的,实在想不出是什么原因,否则可以看看是否用了全角字符。
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#7

帖子 yilan198711 » 2008-12-29 22:16

是直接拷过来的……………………

难道真的没有办法了么??
mint+gnome
aerofox
帖子: 1453
注册时间: 2008-05-24 8:30
送出感谢: 2 次
接收感谢: 31 次

Re: bash: #alias:找不到命令 ??

#8

帖子 aerofox » 2008-12-29 22:25

还有就是调试一下

代码: 全选

bash -v
仔细看一下到哪报错了。
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#9

帖子 yilan198711 » 2008-12-29 22:33

不是太明白,请你看一下…………

# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac
#alias zhcon='zhcon --utf8 --drv=vga'
bash: #alias:找不到命令
# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi

# sudo hint
if [ ! -e $HOME/.sudo_as_admin_successful ]; then
case " $(groups) " in *\ admin\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

EOF
fi
esac
fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- $1
return $?
else
return 127
fi
}
fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
SHELL=/bin/sh lesspipe
export LESSOPEN="| /usr/bin/lesspipe %s";
export LESSCLOSE="/usr/bin/lesspipe %s %s";

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi


alias zhcon='zhcon --utf8 --drv=vga'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# bash_completion - programmable completion functions for bash 3.x
# (backwards compatible with bash 2.05b)
#
# $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# The latest version of this software can be obtained here:
#
# http://www.caliban.org/bash/index.shtml#completion
#
# RELEASE: 20060301

if [[ $- == *v* ]]; then
BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
else
BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
fi

if [[ -n $BASH_COMPLETION_DEBUG ]]; then
set -v
else
set +v
fi
unset BASH_COMPLETION_ORIGINAL_V_VALUE

### Local Variables:
### mode: shell-script
### End:
alias ll='ls -l'
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"
mint+gnome
aerofox
帖子: 1453
注册时间: 2008-05-24 8:30
送出感谢: 2 次
接收感谢: 31 次

Re: bash: #alias:找不到命令 ??

#10

帖子 aerofox » 2008-12-29 22:44

哈哈,确实用了个全角的#号。但是在你早先贴的代码中我没找到,你再找找在哪个文件中。
[code# ;;
#esac
#alias zhcon='zhcon --utf8 --drv=vga'
bash: #alias:找不到命令
# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi][/code]
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#11

帖子 yilan198711 » 2008-12-29 22:54

sorry

不是太明白如何去找那个

不过alias zhcon='zhcon --utf8 --drv=vga'是我后来自己添加行去的,貌似是为了解决zhcon的中文问题的
mint+gnome
aerofox
帖子: 1453
注册时间: 2008-05-24 8:30
送出感谢: 2 次
接收感谢: 31 次

Re: bash: #alias:找不到命令 ??

#12

帖子 aerofox » 2008-12-29 23:13

是你自己加进去的更好啊,更容易找到了。
这个 alias 没有问题,问题是前面加了个注释,加个注释不要紧,可偏偏用错了符号。
你看是不是那个井号比它上一行的井号要往里缩一点啊,用鼠标选一下,发现前后又确实没有空格,因为你用的是一个全角的井号。
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#13

帖子 yilan198711 » 2008-12-29 23:27

我现在把那一行自己添加的文字删除掉了

但是还是没有什么效果

样子依旧…………
mint+gnome
头像
yilan198711
帖子: 1628
注册时间: 2008-06-22 13:38
来自: 武汉
送出感谢: 0
接收感谢: 0

Re: bash: #alias:找不到命令 ??

#14

帖子 yilan198711 » 2008-12-29 23:29

http://hi.baidu.com/0soul/blog/item/ce2 ... f9d99.html

这位仁兄也是出现了一样的毛病,你可以看一下.
mint+gnome
头像
HuntXu
论坛版主
帖子: 5778
注册时间: 2007-09-29 3:09
送出感谢: 0
接收感谢: 6 次

Re: bash: #alias:找不到命令 ??

#15

帖子 HuntXu » 2008-12-29 23:42

yilan198711 写了:我现在把那一行自己添加的文字删除掉了

但是还是没有什么效果

样子依旧…………
重新登录时才读取
HUNT Unfortunately No Talent...
回复

回到 “归档贴”