Bug 65030

Summary: Bash Variable Expansion
Product: [Retired] Red Hat Linux Reporter: Mitchell R. Pryor <mpryor>
Component: bashAssignee: wdovlrrw <brosenkr>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-05-16 16:19:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mitchell R. Pryor 2002-05-16 12:05:01 UTC
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 14:55:23 UTC
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}