Program running and also see a terminal

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

Program running and also see a terminal

#1 Post by bigpup »

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.
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 :shock:
YaPI(any iso installer)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: Program running and also see a terminal

#2 Post by MochiMoppel »

bigpup wrote:Where would this code go in the script?
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=90471]Long time ago[/url] 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....

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

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: Select all

set -xe # at the top, below the crunch-bang

Code: Select all

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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#4 Post by bigpup »

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?
Attachments
yapi.pet
(12.18 KiB) Downloaded 129 times
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 :shock:
YaPI(any iso installer)

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#5 Post by drunkjedi »

I think the 50th line

Code: Select all

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.

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#6 Post by drunkjedi »

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.

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#7 Post by Burn_IT »

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

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#8 Post by MochiMoppel »

@bigpup
drunkjedi is right.

Code: Select all

[ -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.

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#9 Post by bigpup »

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.
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 :shock:
YaPI(any iso installer)

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#10 Post by bigpup »

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: Select all

[ -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!!!!!!!!!!!!!!!!!!!!
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 :shock:
YaPI(any iso installer)

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#11 Post by Burn_IT »

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

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#12 Post by bigpup »

Yes, you must be smarter than the software you are coding :shock:
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 :shock:
YaPI(any iso installer)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#13 Post by musher0 »

Burn_IT wrote:
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? :lol:
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#14 Post by Burn_IT »

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

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#15 Post by bigpup »

Never let a manager tell you how you should do your job :roll: :shock: :D

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

Would you want to work for this guy?
Attachments
bulldog.jpg
(10.92 KiB) Downloaded 86 times
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 :shock:
YaPI(any iso installer)

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#16 Post by Burn_IT »

The only change I would make to that is it is good practice to work the situation so that he ends up telling you to do it the way you were going to anyway, yet thinks it is his idea. That is unless you have ambitions on taking over from him, which as I suggested, may not be a good idea.
Let the manager think HE is in control and everything will be sweet.
The same idea works with spouses.
"Just think of it as leaving early to avoid the rush" - T Pratchett

Post Reply