| Author |
Message |
kommisar
Joined: 20 Feb 2011 Posts: 17
|
Posted: Tue 24 Jul 2012, 23:28 Post_subject:
Howto write a shell script that leaves the shell open |
|
I am trying to write shell script that runs a couple of simple shell commands related to my video card.
i.e.
aticonfig --od-enable
aticonfig --odgt
the latter command is supposed to display a line that shows the temperature of my video card.
When I run this script no shell window is opened and I don't get to see the temperature.
How do I force the script to open and display a shell window so I can see the temp when this script is run?
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5292 Location: Valåmoen, Norway
|
Posted: Wed 25 Jul 2012, 02:22 Post_subject:
|
|
| Code: | | xterm --hold -e aticonfig --odgt |
_________________ Stardust resources
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2730 Location: Kiel,Germany
|
Posted: Wed 25 Jul 2012, 10:04 Post_subject:
|
|
or you can direct output to xconsole
like
xconsole &
while [ something ];do
VALUE=`program | filter`
echo "Value" >/dev/console
done
|
|
Back to top
|
|
 |
kommisar
Joined: 20 Feb 2011 Posts: 17
|
Posted: Sat 04 Aug 2012, 20:24 Post_subject:
|
|
It worked! Thanks for your help.
Now I have a related question. I have tried using an xterm -e command from an ssh connection on a remote machine. It starts the command but the output does not get sent to the ssh shell on the remote machine. Is there anyway to send the ouput from the xterm -e command back to the remote shell that invoked it?
|
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 669
|
Posted: Mon 06 Aug 2012, 12:48 Post_subject:
|
|
| kommisar wrote: | | Is there anyway to send the ouput from the xterm -e command back to the remote shell that invoked it? |
Not that I am aware of. Since running xterm creates a new window for output, you need to eliminate the xterm -e.
You have at least three options:
1. Use you original script (from before you added xterm) when invoking from a shell, and use your new script only when you need a new shell window.
or
2. Create a wrapper script that uses xterm to call your original script. For instance:
| Code: | | xterm -hold -e video_temperature |
Then use the wrapper script when you need a new window.
or
3. Use an if/else in your script to recognize an option to indicate that you want no window. For instance:
| Code: | if [ "$1" = "--nw" ];then
aticonfig --odgt
else
xterm -hold -e aticonfig --odgt
fi |
Then invoke it from your shell with, for instance, video_temperature --nw
There are certainly many other ways to do this as well.
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2730 Location: Kiel,Germany
|
Posted: Mon 06 Aug 2012, 17:53 Post_subject:
|
|
| Quote: | | There are certainly many other ways to do this as well. |
Yup, with the nasty Xdialog --tailbox option
like
| Code: | mkdir -p /tmp/programname
touch /tmp/programname/logfile.log
Xdialog --tailbox /tmp/programname/logfile.log 20 40 &
while [ 1 ];do
echo VALUE >> /tmp/programname/logfile.log
done |
|
|
Back to top
|
|
 |
|