Skip to content

Instantly share code, notes, and snippets.

@debuggerboy
Last active October 4, 2019 16:43
Show Gist options
  • Save debuggerboy/eedb9c6556dd33ee65ced373a8a15b2c to your computer and use it in GitHub Desktop.
Save debuggerboy/eedb9c6556dd33ee65ced373a8a15b2c to your computer and use it in GitHub Desktop.
Sorting text content using Zenity
#!/bin/bash
############################################
# (C) GNU General Public License, version 2
############################################
UNSORT_FILE=$(mktemp /tmp/unsorted.XXXXXXXXX)
SORT_FILE=$(mktemp /tmp/sorted.XXXXXXXXX)
UNSORT_TEXT=$(zenity --text-info --title="Enter Unsorted Content" --width=500 --height=300 --editable)
cat <<EOF > ${UNSORT_FILE}
${UNSORT_TEXT}
EOF
cat ${UNSORT_FILE}
sort ${UNSORT_FILE} > ${SORT_FILE}
zenity --text-info --title="View Sorted Content" --width=500 --height=300 --filename=${SORT_FILE}
rm ${UNSORT_FILE} ${SORT_FILE}
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment