How to run a bash script menu from a file manager

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8360
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to run a bash script menu from a file manager

Post#1 by Ed_P » 20 Jan 2021, 06:32

With Flash gone I have created a script to play a couple of old flash games that I have on my harddrive to show my grandkids what computer games use to be. In terminal mode the script works but not when I dbl click on it in Nemo and select to Run In Terminal mode. Then it displays my menu and when I select a game it disappears. How do I get it to keep the terminal window open and execute the flash app?

Code: Select all

#!/bin/sh

function Title() {
  echo -en "\033]0;$1\a";
}
Title "Grandpa's Flash Games"

g1=space_invaders
g2=pacman

echo
echo 1. $g1
echo
echo 2. $g2
echo
echo 3. $g3
echo
read -p "Select 1, 2 or 3: " Nbr

#Game="$"g$[Nbr].swf
#echo Game=$Game
#read

if [ $Nbr == 1 ]; then Game=$g1".swf"; fi
if [ $Nbr == 2 ]; then Game=$g2".swf"; fi
if [ $Nbr == 3 ]; then Game=$g3".swf"; fi

cd /mnt/sda6/Users/Ed/"My Webpages"/Games/
./flashplayer $Game > /dev/null 2>&1 &
#exit
Ed

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

How to run a bash script from a file manager

Post#2 by beny » 20 Jan 2021, 10:28

hi Ed_P if you have thunar as file manager you can run a script via custom action,the script may be executable.

User avatar
Ed_P
Contributor
Contributor
Posts: 8360
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

How to run a bash script from a file manager

Post#3 by Ed_P » 20 Jan 2021, 20:41

Found a fix. :good:

Replaced the commented out exit line
Ed_P wrote:
20 Jan 2021, 06:32

Code: Select all

#exit
with

Code: Select all

echo & read
solves the problem. :)
Ed

Post Reply