How to make a scipt automatically run in terminal? (Solved)

Booting, installing, newbie
Post Reply
Message
Author
User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

How to make a scipt automatically run in terminal? (Solved)

#1 Post by UncleScrooge »

Hello,

greetings from a newbie.

I'm running BionicPup64.

I have a few netmapping scripts that need to run in the shell.
So I'd like to have the terminal popping up and running the commands (a few need also an input from the user) when I launch the script clicking its icon.

Is it possible?

In Ubuntu I had a partial solution with the xxxxx.desktop files

Thnx in advance.

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

Re: How to make a scipt automatically run in terminal?

#2 Post by enrique »

UncleScrooge
It is not totally clear want you intent to do. But I will assume you what a script to execute at boot.

*BionicPup64 is made from Ubuntu. So you will almost have same access to Ubuntu's way.

*Puppy uses /root/Startup as the preferred folder for your boot script. There are a few other places but Startup is your best choice. Do

Code: Select all

ls /root/Startup
You will find your current boot scripts that can serve for you to use as example.

"xxxxx.desktop"
Same thing in Puppy. Most of .desktop are located at /usr/share/applications

enrique

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#3 Post by nic007 »

Puppy normally has geany installed. One method - RightClick the script > select "Open as Text" from menu (this should open it in geany) > F5 or select execute from geanys toolbar.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

Re: How to make a scipt automatically run in terminal?

#4 Post by jrb »

UncleScrooge wrote:Hello,

greetings from a newbie.

I'm running BionicPup64.

I have a few netmapping scripts that need to run in the shell.
So I'd like to have the terminal popping up and running the commands (a few need also an input from the user) when I launch the script clicking its icon.

Is it possible?

In Ubuntu I had a partial solution with the xxxxx.desktop files

Thnx in advance.
For scripts with no target ($1):

Code: Select all

#!/bin/sh
#open in terminal
tty -s; if [ $? -ne 0 ]; then xterm -hold -e "'$0'"; exit; fi

yourscript
For scripts with a target:

Code: Select all

#!/bin/sh
#open in terminal
tty -s; if [ $? -ne 0 ]; then xterm -hold -e "'$0' '$1'"; exit; fi

yourscript

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#5 Post by rockedge »

xxxxx.desktop files work the same as in Ubuntu and are located in Puppy Linux here ->

Code: Select all

/usr/share/applications
in the xxx.desktop file it is possible to declare that the script or program will open up running in a terminal

User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

How to make a scipt automatically run in terminal?

#6 Post by UncleScrooge »

Thnx rockedge and jrb.
spot on.

Post Reply