How you can get the first three parts from MAC address?
$ mac=11:22:33:44:55:66
$ vendor=${${mac//:/}:0:6}
bash: ${${mac//:/}:0:6}: bad substitution
${mac//:/} removes : and :0:6 should get the first 6 characters?
or other way around:
vendor=${${mac:0:8}//:/}
bash: ${${mac:0:8}//:/}: bad substitution
Expected: 112233. What's the correct syntax?
This works but needs two assignments:
vendor=${mac//:/}
vendor=${vendor:0:6}
echo $vendor
112233
Can you do this with one line with only bash?
GNU bash version is 5.1.0
vendor=${mac//:/}; vendor=${vendor:0:6}; echo "$vendor". But really, is it such a big issue to use the temporary?