From 6b506130775b71f50a8ec8b8b635e224cb93125f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 10 Nov 2008 17:10:08 -0800 Subject: Sort interfaces in bonding operational mode commands For consistency with show interfaces, sort output by device name --- scripts/vyatta-show-bonding.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-show-bonding.pl b/scripts/vyatta-show-bonding.pl index 2b7c8d6..8a0daee 100755 --- a/scripts/vyatta-show-bonding.pl +++ b/scripts/vyatta-show-bonding.pl @@ -71,7 +71,7 @@ sub show_brief { my $format = "%-12s %-10s %-8s %-6s %s\n"; printf $format, 'Interface', 'Mode', 'State', 'Link', 'Slaves'; - foreach my $intf (@interfaces) { + foreach my $intf (sort @interfaces) { my $mode = get_sysfs_value( $intf, "bonding/mode" ); $mode =~ s/ [0-9]+$//; my ( $state, $link ) = get_state_link($intf); @@ -86,14 +86,14 @@ sub show { my $format = "%-16s %-10s %-10s %-10s %-10s\n"; printf $format, "Interface", "RX: bytes", "packets", "TX: bytes", "packets"; - foreach my $intf (@interfaces) { + foreach my $intf (sort @interfaces) { my @slaves = split( / /, get_sysfs_value( $intf, "bonding/slaves" ) ); printf $format, $intf, get_sysfs_value( $intf, "statistics/rx_bytes" ), get_sysfs_value( $intf, "statistics/rx_packets" ), get_sysfs_value( $intf, "statistics/tx_bytes" ), get_sysfs_value( $intf, "statistics/tx_packets" ); - foreach my $slave (@slaves) { + foreach my $slave (sort @slaves) { printf $format, ' ' . $slave, get_sysfs_value( $slave, "statistics/rx_bytes" ), get_sysfs_value( $slave, "statistics/rx_packets" ), -- cgit v1.2.3