Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 14 Dec 2017, 04:24
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Program running and also see a terminal
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
bigpup


Joined: 11 Oct 2009
Posts: 9673
Location: Charleston S.C. USA

PostPosted: Fri 31 Mar 2017, 09:02    Post subject:  Program running and also see a terminal
Subject description: How do you make terminal show when program runs?
 

I have a shell script file for a program.

What command can I add that will make the terminal show when the program runs?
Where would this code go in the script?

I want to be able to see what is happening with the code as the program operates.

The terminal should show this as the program operates.

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1398
Location: Japan

PostPosted: Fri 31 Mar 2017, 09:50    Post subject: Re: Program running and also see a terminal
Subject description: How do you make terminal show when program runs?
 

bigpup wrote:
Where would this code go in the script?

Long time ago bigpup wrote:
The things you do not tell us are usually the clue to finding the answer
So please give us a clue. What does the script look like and what is it supposed to do? And the program: Is it intended to run in a terminal and "show what is happening to the code"? If so you could start it from a terminal or start a script that starts a terminal that starts the program, but I'm alreay drifting into a cloud of speculation....
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11262
Location: Gatineau (Qc), Canada

PostPosted: Fri 31 Mar 2017, 10:12    Post subject:  

HI bigpup.

As MochiMoppei mentioned, you're a bit in the vague.

This is what I do when I want to observe the execution of a script
in a terminal (all words are important in this sentence):
Code:
set -xe # at the top, below the crunch-bang
Code:
set +xe # as the last line.

If the script has errors, the "set -xe" makes ths script stop at every error
so you can correct it.

There are other ways.

IHTH

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9673
Location: Charleston S.C. USA

PostPosted: Fri 31 Mar 2017, 10:47    Post subject:  

Ok let me ask this a different way.

Here is the program.

When it runs the terminal also shows.

So what in the program code is making it do this and how to stop it?
yapi.pet
Description 
pet

 Download 
Filename  yapi.pet 
Filesize  12.18 KB 
Downloaded  37 Time(s) 

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
drunkjedi


Joined: 24 May 2015
Posts: 684

PostPosted: Fri 31 Mar 2017, 10:56    Post subject:  

I think the 50th line
Code:
exec urxvt -bg "#ffffe0" -fg black -title "$TITLE" encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext -e "$0" "$@"
try hashing it out.
I tried it on Fatdog, it runs without the terminal after hashing that out. Not thoroughly tested.
It's taking too much time searching for ISO files in my drives. (Which is same when the terminal is shown, while terminal is showing no msgs.)

Edit: It finally gave me a list of all ISOs I have. Damn I have too many Pups idle.
Back to top
View user's profile Send private message 
drunkjedi


Joined: 24 May 2015
Posts: 684

PostPosted: Fri 31 Mar 2017, 11:08    Post subject:  

With the terminal shown, the program didn't show any output in it till the list of ISOs was shown.
Maybe it will show after the iso to install is selected...
I don't have a spare usb drive now to test it out.
Maybe I will try it in qemu in Fatdog.

Edit: Sorry got to go, daughter is calling me for dinner. See ya later.
Back to top
View user's profile Send private message 
Burn_IT


Joined: 12 Aug 2006
Posts: 2928
Location: Tamworth UK

PostPosted: Fri 31 Mar 2017, 11:13    Post subject:  

Is it not Echo ON rather thaan ECHO OFF at the top of the script.???
_________________
"Just think of it as leaving early to avoid the rush" - T Pratchett
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1398
Location: Japan

PostPosted: Fri 31 Mar 2017, 11:38    Post subject:  

@bigpup
drunkjedi is right.
Code:
[ -t 0 ] || exec urxvt -bg "#ffffe0" -fg black -title "$TITLE" encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext -e "$0" "$@"

[ -t 0 ] tests if the script was started from a terminal. If not it starts one (urxvt) and tells urxvt to run the script.
After restarting in the newly created urxvt it will pass through this test because it now is running in a terminal and can continue to execute the code after line 50. Commenting out the whole line should disable this test and the creation of urxvt.

I wonder why the script is so keen to run in a terminal. Messages to the user don't make use of the terminal but are sent via a GUI dialog. Could be a safeguard against unexpected errors and hang-ups. I recommend to keep the line and the terminal.
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9673
Location: Charleston S.C. USA

PostPosted: Fri 31 Mar 2017, 17:37    Post subject:  

drunkjedi wrote:
It's taking too much time searching for ISO files in my drives.

Edit: It finally gave me a list of all ISOs I have. Damn I have too many Pups idle.

This search can take some time.
Especially if you have a lot of places to search and a lot of iso's to find.
This search feature of the program will look on any storage devices hooked to the computer. Hard drives, usb drives, micro cards, anything.

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9673
Location: Charleston S.C. USA

PostPosted: Fri 31 Mar 2017, 17:48    Post subject:  

Thanks for the information on what you found!!!!!!!!!

I think this terminal showing is left over from development of the program. Wanted to see what was happening with the code. Spent a lot of time working out bugs and tweaking how it would work.
After all the code changes that where made, over several months.
I kind of forgot what was doing the terminal showing.

I was also thinking this was the code:
Code:
[ -t 0 ] || exec urxvt -bg "#ffffe0" -fg black -title "$TITLE" encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext -e "$0" "$@
"
Just seems to be a lot of code just to make the terminal show as the program operates.

As you say, it seems to still work OK with this hashed out.

Thanks ALL for the help!!!!!!!!!!!!!!!!!!!!

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
Burn_IT


Joined: 12 Aug 2006
Posts: 2928
Location: Tamworth UK

PostPosted: Fri 31 Mar 2017, 18:11    Post subject:  

Quote:
This search can take some time


This reminds me of something someone in my office did when I was working at Granada TV rental.
Now you need to know that from our office in Bedford we had connections to every Granada TV shop in the world as well as all the studios and service centres etc.
All he did was write a simple query to find out whether the printer was out of ink or not. Then he remembered that there was another printer in the next office and thought he would check that as well to save two trips to the stationary office for refills.
Unfortunately he queried all online printers and forgot to limit the locaction.
So 6 hours later he got his answer from EVERY SINGLE PRINTER IN THE ORGANISATION THROUGHOUT THE WORLD.

_________________
"Just think of it as leaving early to avoid the rush" - T Pratchett
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9673
Location: Charleston S.C. USA

PostPosted: Sat 01 Apr 2017, 15:49    Post subject:  

Yes, you must be smarter than the software you are coding Shocked
_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11262
Location: Gatineau (Qc), Canada

PostPosted: Sat 01 Apr 2017, 15:52    Post subject:  

Burn_IT wrote:
Quote:
This search can take some time


This reminds me of something someone in my office did when I was working at Granada TV rental.
Now you need to know that from our office in Bedford we had connections to every Granada TV shop in the world as well as all the studios and service centres etc.
All he did was write a simple query to find out whether the printer was out of ink or not. Then he remembered that there was another printer in the next office and thought he would check that as well to save two trips to the stationary office for refills.
Unfortunately he queried all online printers and forgot to limit the locaction.
So 6 hours later he got his answer from EVERY SINGLE PRINTER IN THE ORGANISATION THROUGHOUT THE WORLD.

Hi Burn_IT.

What happened to the man? Did he get fired or did he get a promotion? Laughing

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Burn_IT


Joined: 12 Aug 2006
Posts: 2928
Location: Tamworth UK

PostPosted: Sat 01 Apr 2017, 16:43    Post subject:  

As far as I know he is still busy replacing ink cartridges!!!
The last I heard he was a man manager at the same place - no technical responsibilities at all.
That actually was one thing they were good at. That was recognising that technically able people made bad managers and good managers were technically challenged so they had parallel career paths.

_________________
"Just think of it as leaving early to avoid the rush" - T Pratchett
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9673
Location: Charleston S.C. USA

PostPosted: Sat 01 Apr 2017, 17:55    Post subject:  

Never let a manager tell you how you should do your job Rolling Eyes Shocked Very Happy

Well, make them think you are going to do it the way they say, but do it the way you know works! Very Happy

Would you want to work for this guy?
bulldog.jpg
 Description   
 Filesize   10.92 KB
 Viewed   76 Time(s)

bulldog.jpg


_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0535s ][ Queries: 14 (0.0045s) ][ GZIP on ]