Show stdout and stderr in Zenith

I am trying to install .deb file by right clicking on it in Nemo.

My Nemo Action Looks like:

[Nemo Action]
Name=Install Deb File
Comment=Install %F
Exec=<scripts/install_deb_file.sh %F>
Icon-Name=package-x-generic-symbolic
Selection=s
Extensions=deb;
EscapeSpaces=true
Dependencies=zenity;dpkg;

My zenity_askpass.sh file looks like:

#!/bin/bash
zenity --password --title="Authenticate"

My install_deb_file.sh file looks like:

#!/bin/dash

export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"
sudo dpkg -i "$1"

How can I modify install_deb_file.sh so that it install the .deb package and show the stdout / stderr of sudo dpkg -i "$1" in zenity.

Asked By: Ahmad Ismail

||

The install_deb_file.sh file:

#!/bin/dash

export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/scripts/zenity_askpass.sh"

# zenity --notification --text="$(sudo dpkg -i "$1" 2>&1)"

# zenity --width=250 --height=250 --info --text="$(sudo dpkg -i "$1" 2>&1)"

COMMAND_OUTPUT=$(sudo dpkg -i "$1" 2>&1)

if [ $? = 1 ]; then
    zenity --info --width=250 --text="$COMMAND_OUTPUT"
    exit 1
else
    notify-send --expire-time=200000 "Successfully Installed $1"
    exit 0
fi
Answered By: Ahmad Ismail