Skip to content

Instantly share code, notes, and snippets.

@Pzoom522
Last active September 21, 2021 18:23
Show Gist options
  • Save Pzoom522/e6e0384c97b9b29db5be5aab746ee706 to your computer and use it in GitHub Desktop.
Save Pzoom522/e6e0384c97b9b29db5be5aab746ee706 to your computer and use it in GitHub Desktop.
shell script to traverse all language pairs
#!/bin/bash
function traverse(){
lang_list=($1)
ban=0
for i in "${!lang_list[@]}"
do
ban=$((ban + 1))
# echo "$ban"
for j in "${!lang_list[@]}"
do
if ((j >= ban)); then
echo "${lang_list[$i]}"-"${lang_list[$j]}"
fi
done
done
}
# test
langs=(en de es fr hi pl)
traverse "${gats_langs[*]}"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment