[ Date Index ][
Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
Any BASH experts out there? I am looking at substrings, and do not seem to be able to get negative offsets to work the way the man pages say/imply - "If offset evaluates to a number less than zero, the value is used as an offset from the end of the value of parameter." ${var:offset:length} works fine if all are positive ${var:-3:3} I thought would give me that last 3 chars of $var, but gives me the whole string. ${var:3,-3} Note the comma. This DOES work (found by accident), but I can't find this syntax documented. Incidently (in this last example) it does not matter what number I have as the offset - even beyond the length of $var - but I must have one. Any ideas? What is going on here? Clive ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe.