免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1524 | 回复: 3
打印 上一主题 下一主题

请问如何得知Shell的种类? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-04-30 11:34 |只看该作者 |倒序浏览
我的OS是HP-UX11i,显示Root的Shell为/sbin/sh,他是什么shell呢?和/usr/bin/sh有区别吗?
有什么命令来显示shell的种类和版本吗?

论坛徽章:
0
2 [报告]
发表于 2004-04-30 15:26 |只看该作者

请问如何得知Shell的种类?

hpux得root默认shell是posix,/sbin下得命令一般都是只有root权限才能用命令,通常是一些系统管理命令,而/usr/bin下得命令就是一般用户用得命令了~
每个用户登录的shell种类可以在/etc/passwd中得最后一列看到~

论坛徽章:
0
3 [报告]
发表于 2004-04-30 18:26 |只看该作者

请问如何得知Shell的种类?

书上讲/usr/bin/sh为POSIX shell,那么既然/sbin/sh也是POSIX shell,何必要搞两份copy呢? 要知道二者的inode和大小都不一样的。我看/sbin/sh未必就是POSIX shell.
迷茫中...

论坛徽章:
0
4 [报告]
发表于 2004-05-06 19:29 |只看该作者

请问如何得知Shell的种类?

还是楼主看书看的精啊,我都没注意,不好意思~
上网查了一下,发现solaris有以下这种解释

/sbin/sh和/bin/sh的区别

Both /sbin/sh and /usr/bin/sh shells are Bourne shells.

The difference is that /sbin/sh is statically linked and /usr/bin/sh is
dynamically linked. There is also /bin/sh, however /bin is just a symbolic
link to /usr/bin.

# ls -l /sbin/sh
-r-xr-xr-x 2 bin root 251712 Jul 16 1997 /sbin/sh

# file /sbin/sh
/sbin/sh: ELF 32-bit MSB executable SPARC Version 1, statically linked, stripped

# ldd /sbin/sh
ldd: /sbin/sh: file is not a dynamic executable or shared object


# ls -l /usr/bin/sh
-r-xr-xr-x 3 bin root 88620 Jul 16 1997 /usr/bin/sh

# file /usr/bin/sh
/usr/bin/sh: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped

# ldd /usr/bin/sh
libc.so.1 =>; /usr/lib/libc.so.1
libdl.so.1 =>; /usr/lib/libdl.so.1

Dynamically linked binaries use shared libraries during their execution. This
makes them smaller in size and when libraries get updated, the binaries will
automatically use the updated libraries.

Statically linked binaries contain all the code within them. They do not
use shared libraries at all. This makes them larger in size. The useful thing
about statically linked binaries is that they can run all by themselves as
they do not depend on shared libraries. If the system is "broken" and libraries
were removed, damaged, or /usr is not mounted, /sbin/sh can still be executed.

This is why it is recommended to use /sbin/sh as the default root shell.


想来hpux应该也同理吧,只不过把bsh改成了posix shell了~
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP