bash character substitution? Need help

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Fri Feb 6 19:14:47 UTC 2004


Quick note, I tried running the script (to see if I could decypher it) 
and I got this;
./test-parse: line 3: ${X,1,17}: bad substitution

Madison

Grant Cullen wrote:
> Madison, the following will give the basic parsing.
> 
> Good luck
> 
> #!/bin/bash
> X='00:11:22:33:44:55>21,53,80-85'
> MAC=${X,1,17}
> [ ${#X} -gt 18 ] &&
>  {
>   # we have ports - length greater than 18
>   IFS=','
>   for PORT in ${x:18}
>    do
>     echo "iptable entry with port " $PORT
>    done
>  } ||
>  {
>   # no ports
>   echo "iptable entry without ports"
>  }
> 
> Grant Cullen
> JADALL Consulting Ltd.
> grant.cullen-rieW9WUcm8FFJ04o6PK0Fg at public.gmane.org
> 416-706-4447

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list