LinuxSir.cn,穿越时空的Linuxsir!

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

Bash 4.0 problem in Untubn 9.1

[复制链接]
发表于 2009-12-21 14:33:03 | 显示全部楼层 |阅读模式
Hi, I was hit by a Bash 4.0 problem when upgrading to Untubn 9.1.  When I ran the script below, Bash 4.0 reported that .gen_funcs can't be found and the following funcitons defined in this file. Seems Bash 4.0 has different option setting with Bash 3.2.48 in Untubn 9.04. (the system defualt shell has already been changed to from dash to bash.)

I tried to add set +o posix and set -s dotglob here, then it works. However, this way is not a good solution, because there are many other script files which need to work.  Then I added a ENV setting in .bashrc: export ENV=/home/song/tmp. But it only works in the bash terminal (can display with set -o and shopt). It doesn't work for script like ./setup.sh.

Is there any other way to control the the execution for srcipts (/bin/sh)? Thanks for your help.

//tmp file
set +o posix
shopt -s dotglob

// script in setup.sh
#!/bin/sh
// bin/sh are symbol link to /bin/bash
//When adding set +o posix and set -s dotglob here, then it works.

if [ -e ./.config ]; then
        . ./.config
else
        . .gen_funcs
fi
......// the functions are defined in .gen_funcs
        tools_setup "$1"
                env_setup


// bash 4.0.33 in Untubn 9.1
song@ubuntu: ~$ bash --version
GNU bash, version 4.0.33(1)-release (i486-pc-linux-gnu)

//bash 3.2.48 in Untunbn 9.04
song@song-Ubuntu: ~$ sh --version
GNU bash, version 3.2.48(1)-release (i486-pc-linux-gnu)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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