[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Substring Expansion does not work as intended
From: |
eckard . brauer |
Subject: |
Substring Expansion does not work as intended |
Date: |
Wed, 20 Aug 2014 15:05:48 +0200 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I./include -I. -I./include -I./lib
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
-DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin'
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout'
-DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -march=core2 -O2 -pipe
uname output: Linux walter 3.15.8-geek #2 SMP PREEMPT Tue Aug 12 14:12:15 CEST
2014 x86_64 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.2
Patch Level: 47
Release Status: release
Description:
Substring Expansion actually works different than manpage states,
namely:
"If offset evaluates to a number less than zero, the value is used as
an offset from the end of the value of parameter."
Repeat-By:
x="abcdef"; echo "${x:-2}"
Expected: ef
Got: abcdef
or:
x="abcdef"; echo "${x:-2:1}"
Expected: e
Got: abcdef
- Substring Expansion does not work as intended,
eckard . brauer <=