Last active
July 28, 2022 11:08
-
-
Save kvpb/c43da7dfa18d8873f4469e884da86100 to your computer and use it in GitHub Desktop.
Test Script 73: BASH pairwise comparison without duplicates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
var=( {0..9} ); #var=( $({0..$[RANDOM%+9]}) ); | |
printf "Set: {$(var2=$(printf ", %s" "${var[@]}") && var2=${var2:2} && printf "${var2}\n";)}"'\n'"Pairs: "'\n'; | |
for (( i = 0; i < ${#var[@]}; i++ )); | |
do | |
for (( j = i + 1; j < ${#var[@]}; j++ )); | |
do | |
# printf "(${i}, ${j}): "'%d\n'; #printf "(${!var[${i}]}, ${!var[${j}]}): "'%d\n'; # array element nummbers | |
printf "(${var[${i}]}, ${var[${j}]})"'\n'; # array elements | |
done; | |
done; | |
# script73.sh | |
# Test Script 73: BASH pairwise comparison without duplicates | |
# | |
# Author: Karl V. P. Bertin `kvpb` | |
# Telephone: +33 A BB BB BB BB | |
# Email: local-part@domain | |
# LinkedIn: https://www.linkedin.com/in/karlbertin | |
# Facebook: https://www.facebook.com/profile.php?id= | |
# Instagram: https://www.instagram.com/karlbertin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment