fork(1) download
  1. #!/bin/bash
  2.  
  3. link_mode_expected=15000
  4.  
  5. awk -v lme="$link_mode_expected" '
  6. s && /:/ { s=0 }
  7. /Supported link modes:/ { s=1 }
  8. s { print "# s", $NF + 0, ($NF + 0 == lme ? "==" : "<>"), lme }
  9. s && ($NF + 0 == lme) { sgood++ }
  10. a && /:/ { a=0 }
  11. /Advertised link modes:/ { a=1 }
  12. a { print "# a", $NF + 0, ($NF + 0 == lme ? "==" : "<>"), lme }
  13. a && ($NF + 0 == lme) { agood++ }
  14. END { exit 1-(agood && sgood) }' &&
  15. echo yes || echo no
Success #stdin #stdout 0.01s 5460KB
stdin
Settings for eth1:                                                                                                                                                                                                       
        Supported ports: [ Backplane ]                                                                                                                                                                                   
        Supported link modes:   1000baseKX/Full                                                                                                                                                                          
                                10000baseKR/Full                                                                                                                                                                         
                                15000baseKR/Full                                                                                                                                                                         
        Supported pause frame use: Symmetric                                                                                                                                                                             
        Supports auto-negotiation: Yes                                                                                                                                                                                   
        Supported FEC modes: None BaseR RS                                                                                                                                                                               
        Advertised link modes:  1000baseKX/Full                                                                                                                                                                          
                                10000baseKR/Full                                                                                                                                                                         
                                15000baseKR/Full
stdout
# s 1000 <> 15000
# s 10000 <> 15000
# s 15000 == 15000
# a 1000 <> 15000
# a 10000 <> 15000
# a 15000 == 15000
yes