Chinaunix
标题:
tab键自动补全
[打印本页]
作者:
reb00t
时间:
2014-05-21 12:49
标题:
tab键自动补全
本帖最后由 reb00t 于 2014-05-21 12:50 编辑
openbsd5.4 安装完bash后,按tab键默认能补全文件名,或路径
最近测试openbsd5.5 发现不能补全,求大神支招。
说明: 环境都是bash
QQ截图20140521124653.png
(13.83 KB, 下载次数: 40)
下载附件
2014-05-21 12:48 上传
作者:
reb00t
时间:
2014-05-21 21:04
本帖最后由 reb00t 于 2014-05-22 10:33 编辑
上面的问题,重新编译一次bash就解决了。
但是出现第二个问题了
默认的KSH是启动时正常的,但是用bash就会有如下错误
sshd/etc/rc.d/rc.subr: line 163: type: rc_post: not found
(ok)
+ /etc/rc.d/sshd start
sshd/etc/rc.d/rc.subr: line 140: type: rc_pre: not found
(ok)
导致系统重启后,会卡在这服务启动的界面,进不去系统!!!
作者:
reb00t
时间:
2014-05-22 10:49
本帖最后由 reb00t 于 2014-05-22 10:50 编辑
BSD的大神们,出来研究下吧。。
发现上面的问题原因了。
因为我软连接 sh-->bash
如果把软连接改回去就不报如上错误了。。
在linux系统里面 默认有ln -s /bin/bash /bin/sh
openbsd这样用,就会服务启动报错,重启机器后进不去系统。
疑问: 如何解决上面的报错,bash跟sh 之间的区别。。
作者:
prcardin
时间:
2014-05-22 10:52
求大神路过
作者:
reb00t
时间:
2014-05-22 10:55
# $OpenBSD: rc.subr,v 1.70 2013/07/11 09:34:33 otto Exp $
#
# Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2010, 2011 Robert Nagy <robert@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Default functions and variables used by rc.d(8) scripts.
rc_err() {
echo $1 1>&2
exit 1
}
rc_is_supported() {
local _enotsup
eval _enotsup=\${rc_$1}
[ X"${_enotsup}" != X"NO" ]
}
rc_usage() {
local _a _allsup
for _a in start stop restart reload check; do
rc_is_supported ${_a} && _allsup="${_allsup:+$_allsup|}${_a}"
done
rc_err "usage: $0 [-df] (${_allsup})"
}
rc_write_runfile() {
[ -d ${_RC_RUNDIR} ] || mkdir -p ${_RC_RUNDIR} && \
print -rn -- "${pexp}" > ${_RC_RUNFILE}
}
rc_read_runfile() {
local _new_pexp
[ -f ${_RC_RUNFILE} ] && _new_pexp=$(< ${_RC_RUNFILE})
[ -n "${_new_pexp}" ] && pexp="${_new_pexp}"
}
rc_rm_runfile() {
rm -f ${_RC_RUNFILE}
}
rc_start() {
${rcexec} "${daemon} ${daemon_flags} ${_bg}"
}
rc_check() {
pgrep -q -f "^${pexp}"
}
rc_reload() {
pkill -HUP -f "^${pexp}"
}
rc_stop() {
pkill -f "^${pexp}"
}
rc_do() {
if [ -n "${_RC_DEBUG}" ]; then
echo "doing $@" && "$@"
else
"$@" >/dev/null 2>&1
fi
}
rc_exit() {
local _pfix
[ -z "${INRC}" -o X"$1" != X"ok" ] && _pfix="($1)"
echo ${INRC:+'-n'} "${_pfix}"
[ X"$1" = X"ok" ] && exit 0 || exit 1
}
rc_wait() {
local _i=0 _w=${2:-30}
while [ $_i -lt $_w ]; do
case "$1" in
reload|start)
rc_do rc_check && return 0
;;
stop)
rc_do rc_check || return 0
;;
*)
break
;;
esac
sleep 1
_i=$((_i+1))
done
return 1
}
rc_cmd() {
local _bg _n
[ "$(id -u)" -eq 0 ] || \
[ X"${rc_usercheck}" != X"NO" -a X"$1" = "Xcheck" ] || \
rc_err "$0: need root privileges"
if ! (rc_is_supported start && rc_is_supported stop); then
rc_restart=NO
fi
if ! rc_is_supported $1; then
[ -n "${INRC}" ] && exit 1
rc_err "$0: $1 is not supported"
fi
[ X"${rc_bg}" = X"YES" ] && _bg="&"
[ -n "${_RC_DEBUG}" ] || _n="-n"
rc_do rc_read_runfile
case "$1" in
check)
rc_do rc_check
;;
start)
if [ X"${daemon_flags}" = X"NO" ]; then
rc_err "$0: need -f to force $1 since ${_name}_flags=NO"
exit 1
fi
[ -z "${INRC}" ] && rc_do rc_check && exit 0
echo $_n "${INRC:+ }${_name}"
while true; do # no real loop, only needed to break
if type rc_pre >/dev/null; then
rc_do rc_pre || break
fi
# XXX only checks the status of the return code,
# and _not_ that the daemon is actually running
rc_do rc_start || break
if [ -n "${_bg}" ]; then
sleep 1
rc_do rc_wait start || break
fi
rc_do rc_write_runfile
rc_exit ok
done
# handle failure
type rc_post >/dev/null && rc_do rc_post
rc_do rc_rm_runfile
rc_exit failed
;;
stop)
rc_do rc_check || exit 0
echo $_n "${INRC:+ }${_name}"
rc_do rc_stop || rc_exit failed
rc_do rc_wait stop || rc_exit failed
if type rc_post >/dev/null; then \
rc_do rc_post || rc_exit failed
fi
rc_do rc_rm_runfile
rc_exit ok
;;
reload)
rc_do rc_check || exit 0
echo $_n "${INRC:+ }${_name}"
rc_do rc_reload || rc_exit failed
rc_do rc_wait reload || rc_exit failed
rc_exit ok
;;
restart)
$0 ${_RC_DEBUG} ${_RC_FORCE} stop &&
$0 ${_RC_DEBUG} ${_RC_FORCE} start
;;
*)
rc_usage
;;
esac
}
. /etc/rc.conf
[ -n "${daemon}" ] || rc_err "$0: daemon is not set"
unset _RC_DEBUG _RC_FORCE
while getopts "df" c; do
case "$c" in
d) _RC_DEBUG=-d;;
f) _RC_FORCE=-f;;
*) rc_usage;;
esac
done
shift $((OPTIND-1))
_name=$(basename $0)
_RC_RUNDIR=/var/run/rc.d
_RC_RUNFILE=${_RC_RUNDIR}/${_name}
eval _rcflags=\${${_name}_flags}
eval _rcuser=\${${_name}_user}
getcap -f /etc/login.conf ${_name} 1>/dev/null 2>&1 && \
daemon_class=${_name}
[ -z "${daemon_class}" ] && daemon_class=daemon
[ -z "${daemon_user}" ] && daemon_user=root
[ -n "${_RC_FORCE}" ] && [ X"${_rcflags}" = X"NO" ] && unset _rcflags
[ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
[ -n "${_rcuser}" ] && daemon_user=${_rcuser}
# sanitize
daemon_flags=$(printf ' %s' ${daemon_flags})
daemon_flags=${daemon_flags## }
readonly daemon_class
unset _rcflags _rcuser
pexp="${daemon}${daemon_flags:+ ${daemon_flags}}"
rcexec="su -l -c ${daemon_class} -s /bin/bak_sh ${daemon_user} -c"
复制代码
作者:
reb00t
时间:
2014-05-22 12:31
用XXX办法解决了。。
/etc/rc.conf 需要启动的服务器全部改成NO
把需要启动服务器的命令 加到 /etc/rc.local
例如:
/usr/sbin/syslogd
/usr/sbin/sshd
机器断电,或者XXX重启进入系统正常~~~
作者:
芭比小柒
时间:
2014-05-23 07:45
看你自言自语,,是BSD板块可悲还是什么呢。。
http://zh.wikipedia.org/zh/Bourne_shell
sh 不是你 ln -s ,想 ln -s 就 ln -s 的。。
你不知道你的解决方案有导致大问题么。。。。。
作者:
芭比小柒
时间:
2014-05-23 07:49
真心不知道你替换sh有什么目的。。哇哈哈。。
OpenBSD sh好像就是ksh,
FreeBSD sh 是B sh,
启动脚本用什么shell跟你貌似咩毛线关系。。
作者:
reb00t
时间:
2014-05-23 15:41
回复
8#
芭比小柒
多谢你的回复 ,openbsd是ksh.. 软连接是错误的。
主要是平时大家喜欢在redhat平台下工作,习惯了 sh XXXX.sh方式。。。 如果是ksh 语法不一样,会报错。
因此就做软连接了。
或者作alias 自己HOME 环境设置,也许可以解决这个问题。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2