LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 776|回复: 1

意外发现:脚本中不检查别名!

[复制链接]
发表于 2006-1-19 14:11:41 | 显示全部楼层 |阅读模式
我自己定义了别名:alias do=pwd, 然后运行do ,再作了一个while循环,想看看do被定义为别的意思后,while如何出错,不料执行到第一个do的行时,提示"command not found",我又试了一下在脚本中运行ll,也是这样!重大发现,与弟兄们分享,呵呵!
发表于 2006-1-20 19:23:20 | 显示全部楼层
如果你查一下bash的手册的话,会更明白的。

Aliases are not expanded when the shell is not interactive, unless  the
       expand_aliases  shell option is set using shopt (see the description of
       shopt under SHELL BUILTIN COMMANDS below).



这些都在手册上,查一下的话你就不会认为是什么重大发现了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表