Created
October 4, 2018 08:29
-
-
Save paulmr/c7dfb85666d6f3d13ce0914e3ce033a3 to your computer and use it in GitHub Desktop.
simple (fish) shell script to execute a command via an X dialog box
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
#!/bin/fish | |
set -l histfile ~/.x-shell-command-history | |
set -l lastcmd "" | |
if test -f $histfile | |
set lastcmd (cat $histfile) | |
end | |
if set -l command (zenity --entry --entry-text="$lastcmd" --text="Command to execute:" --title="x-shell-command") | |
set -l output (eval $command) | |
if test $status -eq 0 | |
if test -n "$output" | |
zenity --info --text="$output" | |
end | |
else | |
zenity --error --text="$output" | |
end | |
echo "$command" >$histfile | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment