Terminal window is not created automatically. You have to create it yourself. I modified your script as follows:
#!/usr/bin/bash
function commands-to-be-run {
echo "THIS IS TEST!"
read -r -p "PLEASE ENTER TO EXIT! Waiting..."
}
export -f commands-to-be-run
gnome-terminal --title="Testing..." --wait -- bash -c commands-to-be-run
notify-send "COMPLETED!" "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS} ___ ${NAUTILUS_SCRIPT_SELECTED_URIS} ___ ${NAUTILUS_SCRIPT_CURRENT_URI}"
I have put all your statements (commands to be run inside the terminal) into a bash
function and export
ed it, so that it can be used by child processes.
Then, I used the gnome-terminal --title="Testing..."
command to create a terminal window with an appropriate title. The --wait
option will force the gnome-terminal
command not to return until the commands to be run after the --
option are finished.
Please, read the man gnome-terminal
page for more options.
Depending on you needs, a shorter version might be this:
#!/usr/bin/bash
gnome-terminal --title="Testing..." --wait -- bash -c '
echo "THIS IS TEST!" ;
read -r -p "PLEASE ENTER TO EXIT! Waiting..."
'
notify-send "COMPLETED!" "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS} ___ ${NAUTILUS_SCRIPT_SELECTED_URIS} ___ ${NAUTILUS_SCRIPT_CURRENT_URI}"
Look also at the zenity
command for more options to do input / output from your nautilus scripts. Here is a very basic example:
#!/bin/bash
echo -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sed -z 's/.$//' | xsel -b -i
zenity --info --no-wrap --no-markup --title="File name(s) copied to Clipboard:" --text="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"