Bug 65030 - Bash Variable Expansion
Bash Variable Expansion
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: wdovlrrw
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-16 08:05 EDT by Mitchell R. Pryor
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-05-16 12:19:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mitchell R. Pryor 2002-05-16 08:05:01 EDT
Description of Problem:

Negative offset with variable expansion does not work.


Version-Release number of selected component (if applicable):
2.04.21(1)

How Reproducible:
Enter steps below


Steps to Reproduce:
1. var=12345
2. echo ${var:-2:2}
3. 

Actual Results:
12345

Expected Results:
45

Additional Information:
Comment 1 Bernhard Rosenkraenzer 2002-05-21 10:55:23 EDT
The `:-' doesn't specify a negative offset.  It has a 
well-defined meaning: expand to `2:2' if `var' is unset or null.  If 
you want to use a negative offset in this context, use 
 
        echo ${var: -2:2} 

Note You need to log in before you can comment on or make changes to this bug.