Date created: Friday, April 20, 2018 3:56:16 PM. Last modified: Friday, April 20, 2018 3:56:16 PM
99 Bottles
version 1.1; ns junos = "http://xml.juniper.net/junos/*/junos"; ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; import "../import/junos.xsl"; mvar $num-bottles = 3; var $cur-plural = " bottles of beer on the wall, "; var $next-plural = " bottles of beer."; var $cur-singular = " bottle of beer on the wall, "; var $next-singular = " bottle of beer."; var $cur-none = "No more bottles of beer on the wall, no more bottles of beer."; var $drink = "Take one down and pass it around, "; var $remain-plural = " bottles of beer on the wall."; var $remain-singular = " bottle of beer on the wall."; var $remain-none = "no more bottles of beer on the wall."; var $restock = "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall."; match / { { while ($num-bottles > 0) { if ( $num-bottles > 1 ) { expr jcs:output($num-bottles, $cur-plural, $num-bottles, $next-plural); } else if ( $num-bottles == 1 ) { expr jcs:output($num-bottles, $cur-singular, $num-bottles, $next-singular); } else { expr jcs:output($cur-none); } if ( $num-bottles > 2 ) { expr jcs:output($drink, ($num-bottles - 1), $remain-plural, '\n'); } else if ( $num-bottles == 2 ) { expr jcs:output($drink, ($num-bottles - 1), $remain-singular, '\n'); } else if ( $num-bottles == 1 ) { expr jcs:output($drink, $remain-none, '\n'); } set $num-bottles = ($num-bottles - 1); } set $num-bottles = 99; /* not really needed */ expr jcs:output($restock); } } /* Original for reference: 3 bottles of beer on the wall, 3 bottles of beer. Take one down and pass it around, 2 bottles of beer on the wall. 2 bottles of beer on the wall, 2 bottles of beer. Take one down and pass it around, 1 bottle of beer on the wall. 1 bottle of beer on the wall, 1 bottle of beer. Take one down and pass it around, no more bottles of beer on the wall. No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall. */
Previous page: Base IPv6 IS-IS SR-MPLS Topology
Next page: 7210 SAS-X Overview