Quote:
Originally Posted by 3Gmobile
could you help to explain what does it mean ??
${i%%=*}=$(echo "${i##*=}
thanks you !
${parameter%%pattern} and ${parameter##pattern} work in the same way but difference is that '%%' matches the end of the value of parameter and ## matches the begining of the value of pattern. Lets explain it with example.
In the first iteration, value of i is A=192.168.16.1, ${i%%=*} will match from the end of the value of i, until it finds '=' and will delete the matched pattern, so in this case it'll match '=192.168.16.1' and will delete it, yeilding 'A'.
${i##*=} will match from the begining of the value of i, until it finds '=' and will delete the matched pattern, so in this case it'll match 'A=' and will delete it, yeilding '192.168.16.1'
So ${i%%=*} will output 'A' and ${i##*=} will output '192.168.16.1'
Regards,
Tayyab