Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print to a separate terminal screen

Status
Not open for further replies.

rhnaeco

Technical User
Aug 11, 2005
45
hi, i have a very long BASH shell script which runs through quite quickly.
I want to see the results of part of the script as it is running- i have been doing this through nedit so far, but as i increase the number of input files i have so many nedits open i can't see the results anyway!!
i then tried 'more' but again it ran through so quickly ....

Is there a way of opening another terminal window in the bash script for any 'more' ? statements to be printed to that, whilst all the other echo's and working statements continue to print to the original?
or ANY way of viewing only these lines as they are created (short of removing the other comments)
thanks in advance

rhnaeco
 
Hi

Maybe is not what you want, I don't really understand the question :
[ul]
[li]create a file : [tt][highlight white]touch /tmp/mydebug[/highlight][/tt][/li]
[li]start a [tt]tail[/tt] in some other console/terminal : [tt][highlight white]tail -f /tmp/mydebug[/highlight][/tt][/li]
[li]write debug messages to that file : [tt][highlight white]echo "Debug message" >> /tmp/mydebug[/highlight][/tt][/li]
[/ul]

Feherke.
 
yes, thats worked (using 'more' as the test is within another file). however- i am trying to write this script for others to use too, so i want the 'list of things to do' to be as short as possible- is it possible to open up a terminal and tail it from within the script, or is it going to have be set up before the script is run?

thanks

rhnaeco
 
Hi

Open azn [tt]xterm[/tt] as background process :
Code:
touch /tmp/mydebug
xterm -e tail -f /tmp/mydebug &
echo now printing date >> /tmp/mydebug
date
echo now printing uname >> /tmp/mydebug
uname -a 
echo now printing uptime >> /tmp/mydebug
uname -a

Feherke.
 
xterm seemed to freeze on me when i tried this- but for the benefit of anyone else who uses fedora, i found this worked pretty well
Code:
gnome-terminal --command "bash -c 'tail -f filecheck.dat|less'"

thanks for your help again, scripting has become a much quicker task since i found this forum!!
 
now you've said that, less isn't necessary. i got the code from someone who was having trouble keeping the terminal window open after running ls. I guess thinking about it, tail keeps it open anyway - duh! what can i say but i'm a beginner!
cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top