One single tool with several GUI dialogs, e.g. messagebox, file dialog, string input or choice list.
Examples:
scriptdialogs file -folder="/home" -filter="*.txt"
scriptdialogs info -textfile=results.txt -title="Summary"
scriptdialogs yesno -text="Are you sure?"
scriptdialogs okcancel -text="This will delete all data!" -title="Confirmation"
scriptdialogs choice -text="Please select:" -title="Choose" -list="Option 1,Option 2,Option 3" -default="Option 1"
Usage example for a bash script, see more on page
:
#!/bin/sh
mkdir -p /tmp/backup/latest
fn=$(scriptdialogs file -title="choose file to back up" -folder="/")
if [ -f "$fn" ]; then
cp "$fn" /tmp/backup/latest
scriptdialogs info -text="$fn"$'\n\nhas been saved to /tmp/backup/latest.'
fi
# create backup folder
# ask user for a file
# if file exists and not cancelled:
# copy file to backup
# tell user about success
#scriptdialogs example: Ask for a file and save it to backup folder.
mkdir -p /tmp/backup/latest
fn=$(./scriptdialogs file -title="choose file for backup" -folder="/")
if [ -f "$fn" ]; then
cp "$fn" /tmp/backup/latest
echo "$fn has been saved to backup."
./scriptdialogs info -text="$fn"$'\nhas been saved to backup.'
fi