Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Script not fully compatible with Bash < 4.2 #4

Open
sebastien-prudhomme opened this issue Oct 16, 2014 · 0 comments · May be fixed by #5
Open

Script not fully compatible with Bash < 4.2 #4

sebastien-prudhomme opened this issue Oct 16, 2014 · 0 comments · May be fixed by #5

Comments

@sebastien-prudhomme
Copy link

Hi,
My environment is RHEL6 (with Bash 4.1.2) and i've got this error:

line 111:  -2: substring expression < 0

This syntax is not valid in Bash < 4.2:

free=${freeunit:0:-2}

(negative length is working since Bash 4.2 only)

To make it work:

free=${freeunit:0:${#freeunit}-2}
@atward atward linked a pull request Jan 29, 2015 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant