bug-bash
[Top][All Lists]
Advanced

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

last argument expansion has different output using the sh interpreter


From: Jacoby Hickerson
Subject: last argument expansion has different output using the sh interpreter
Date: Fri, 27 May 2011 12:35:12 -0700

I tried to send this using bash-bug, however I didn't realize my sendmail
was not setup, so here is the description in the format of bash-bug.

Bash Version: 4.2
Patch Level: 10
Release Status: release

Description:
        When executing a test script using the #!/bin/sh interpreter line
the shell expansion for the last argument ${!#} is blank,
        however when using #!/bin/bash the behavior is as expected.  In this
setup /bin/sh is a link to /bin/bash.

Repeat-By:
        Using the following test script:
        #!/bin/sh

        FIRSTARG=$1
        FINALARG=${!#}

        echo $FIRSTARG
        echo $FINALARG

        Output using #!/bin/sh
        [hickersonj@fedora15 ~]$ ./test.sh first last
        first

        Output using #!/bin/bash
        [hickersonj@fedora15 ~]$ ./test.sh first last
        first
        last

Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE
-DRECYCLES_PIDS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
-fasynchronous-unwind-tables
uname output: Linux fedora15.localdomain 2.6.38.6-27.fc15.i686 #1 SMP Sun
May 15 17:57:13 UTC 2011 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Thanks,

Jacoby


reply via email to

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