0

I have working scripts for windscribe vpn. At this time there is no GUI. They run from the desktop no problem. How do I see the output that I would see in the terminal.

I can get the notification window up but how do I get the output in there?

I don't think it matters what the commands are there must be basic command to make this happen.

Is there a better way than using notification window?

3
  • 2
    If you want to see the output anyhow, but neither run the commands in the terminal or have it saved in a logfile, how do you intend to get the output? Do you want the command to open up a new terminal window and print the output to it so that you can close that when you reviewed the output?
    – dessert
    Apr 14, 2019 at 21:04
  • Maybe that is exactly what I want. See connected or disconnected or see report of account status then be on my way. How do I open terminal in script to see I guess is what I am asking. Apr 14, 2019 at 21:09
  • 1
    This is confusing - you have no GUI, yet you run these scripts from a desktop? A desktop implies you have a GUI... Do you have zenity that can display info windows?
    – Xen2050
    Apr 15, 2019 at 5:04

3 Answers 3

1

You could redirect the output to some files, e.g. like this:

./yourscript.sh 1> log.txt 2> errlog.txt

then you could open another terminal window and there you could do something like

tail -f log.txt

and then you should see the output there. The -f option to the tail command means that output is appended as the file grows.

2
  • Well, I don't need to keep a log. Anyway if i run script in terminal, I can see what is happening. Apr 14, 2019 at 20:52
  • 1
    @StaggerLee The whole point is not in keeping the log but in the fact that stdin stream of a script or any other command is tied to controlling terminal. No terminal - no output stream. But of you tie stdin to file, you can view it in any terminal Apr 15, 2019 at 6:10
1

Despite the Q saying you don't have a GUI, apparently you have a Desktop and gnome-terminal, so I'm assuming you also have zenity installed too (it's in Ubuntu by default), so you could have zenity display the output from a command, or from an entire script, like this:

script_output=$(script.sh)
zenity --info --title="Output of script" --text="$script_output"

It will save the standard output (excluding stderr, you could redirect it to stdout too if you wanted) to a variable, then have zenity open a window showing the output in a box similar to this image (but with a different title & contents) that will stay up until you press ok.

enter image description here

2
  • OP explicitly askes “Is there a better way than using notification window?”, but then again the whole question is not really clear – your answer is definitely a good solution and helpful. +1
    – dessert
    Apr 15, 2019 at 8:07
  • 1
    That's another contradiction in the Q, asking "I can get the notification window up but how do I get the output in there?" and also asking for a better way than a notification window... I don't know how they would see anything at all without using a terminal or some type of window notifying them... and they don't seem to be answering with any updates. Thanks though
    – Xen2050
    Apr 27, 2019 at 6:15
0

You can open a new terminal window and run the command in it, e.g. with xterm Install xterm:

xterm -hold -e 'whoami'

The -hold option lets the window stay open, remove it if you want it to auto-close immediately when the process exits. You can also use sleep to let it stay open for a defined period of time after the exit, e.g. xterm -e 'whoami;sleep 2'. The part after-e` is the command or command list to be executed in the new terminal window. This must be the last option on the command line. Note that it doesn’t run a shell if you don’t tell it to do so.

Most other terminal emulators have the same or a similar option, e.g.

gnome-terminal -e 'whoami'

If there’s no equivalent to xterm’s -hold flag you can start a shell to keep the window open:

xterm -e 'whoami;bash'
2
  • Thank you dessert, xterm does not work for me, gnome-terminal does. My next question - Does anyone know what to use to make pause or sleep or waite other than using global setting in terminal to keep open. because I cant really see whats going on. Apr 15, 2019 at 0:55
  • your information is good but i'm new to linux I had no clue about installing xterm terminal now i do, problem solved this line works perfect for me, xterm -e "command to run; sleep 3" I am still searching what to do in gnome terminal just because. Apr 15, 2019 at 2:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .