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 23 May 2013, 00:01
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Howto write a shell script that leaves the shell open
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
kommisar

Joined: 20 Feb 2011
Posts: 17

PostPosted: 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
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5241
Location: Valåmoen, Norway

PostPosted: Wed 25 Jul 2012, 02:22    Post subject:  

Code:
xterm --hold -e aticonfig --odgt

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 2675
Location: Kiel,Germany

PostPosted: 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
View user's profile Send private message Visit poster's website 
kommisar

Joined: 20 Feb 2011
Posts: 17

PostPosted: 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
View user's profile Send private message 
npierce

Joined: 28 Dec 2009
Posts: 637

PostPosted: 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
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 2675
Location: Kiel,Germany

PostPosted: 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
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
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.0451s ][ Queries: 12 (0.0035s) ][ GZIP on ]