Event Timeline
Comment Actions
Who needs executables for every patch version, when you can use git instead.
#! /bin/bash # Converts an amount in kilograms to an approximate equivalent in pounds, "using PHP and git". # See T396312#10903133 / https://oeis.org/A029924 if [ $# -ne 1 ]; then echo "Usage: ./script.sh AMOUNT" exit fi if [ ! -d php-src ]; then git clone https://github.com/php/php-src.git fi KGS=$1 POUNDS=0 while [ $KGS -gt 0 ]; do CUR_KGS=0 LAST_PATCH=0 for PATCH in {1..15}; do TAGGER=$( git -C php-src tag -l php-8.3.$PATCH --format='%(taggername)' ) if [[ "$TAGGER" == "J"* ]]; then if [ $CUR_KGS -ge $KGS ]; then break; fi (( CUR_KGS++ )) LAST_PATCH=$PATCH fi done (( POUNDS += $LAST_PATCH )) (( KGS -= $CUR_KGS )) done echo "$1 kg ~ $POUNDS lbs!"