#!/bin/bash for i in dialog unix2dos; do if ! command -v $i &> /dev/null ; then echo "Please install dialog and dos2unix before using this script." fi done if [[ $# -ne 1 ]]; then echo "usage: $0 filename without the .txt extension." exit 1 fi mapfile -t gameList < <(tail +3 "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/Mini-games reference.txt") for i in "${gameList[@]}" ; do menuList+=("$i" "${i#* }" "off") done unset gameList gameList="$(dialog --clear \ --no-tags \ --ok-label "Add Games" \ --separate-output \ --backtitle "Select games to add to the $1 list." \ --checklist "Press space to check or uncheck a selected game." 0 0 0 "${menuList[@]}" --stdout)" if [[ -z "${gameList}" ]]; then exit 0 fi mkdir -p "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game" echo "$gameList" >> "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt" sort -uno "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt" "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt" eunix2dos "$HOME/.local/wine/crazy-party/drive_c/Program Files/Crazy-Party-beta73/game/${1}.txt" dialog --infobox "Game list \"$1\" updated." 10 80 exit 0