bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

source command differs if in bash or sh mode


From: Gerhard Brauer
Subject: source command differs if in bash or sh mode
Date: Sat, 04 Jul 2009 16:47:19 +0200

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=x86-64
-mtune=generic -O2 -pipe
uname output: Linux ws01 2.6.30-ARCH #1 SMP PREEMPT Fri Jun 19 20:44:03
UTC 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
AuthenticAMD GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.0
Patch Level: 24
Release Status: release

Could you CC me please as I'm not on the list. Thanks.
And sorry for bad english...

Description:
        If i source a file relative to the current directory then - if
in sh mode - sourcing fails with file not found. If i source a file with
absolute or relative path than it works in sh mode. In bash mode i have
no problem.
/bin/sh is here a symlink to bash.
This behavior is new in version 4, old version 3.2 works fine.

Repeat-By:
        cp .bashrc /tmp/bashrc
        cd /tmp
        create a script like that, make it executable
        ---
        #!/bin/sh
        #
        CONFIG=$1
        echo "CONFIG = "$CONFIG
        echo "Test sourcing"
        source "${CONFIG}"
        echo "Fin"
        ---
        Start it with:
        ./test.sh bashrc
        produces:
        CONFIG = bashrc
        Test sourcing
        ./t.sh: line 6: source: bashrc: file not found
        Fin

        If i change shebang to /bin/bash then it works.
        It also works with shebang sh when i specify a explicite path:
        $ LANG=C ./test.sh ./bashrc
        or
        $ LANG=C ./test.sh /tmp/bashrc

Regards
        Gerhard






reply via email to

[Prev in Thread] Current Thread [Next in Thread]