|
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) |
|