LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-15-2005, 09:04 PM   #1
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Rep: Reputation: 30
script that opens the new console and does it's stuff in there


Hi guys,

I want my script to open another terminal and execute itself in there, while I am doing my stuff in the old terminal. How do I put this in the script?

My script is piece of cake, to display the time every 10 seconds.
Code:
$cat ticktack
trap 'echo clock killed; exit 1' 2
while true
do
clear
date +%r
sleep 10
done
BUt I wanna be able to just type ticktack and another small console opens in the corner with the clock working in there. Thanks.

Last edited by frankie_DJ; 08-15-2005 at 09:21 PM.
 
Old 08-15-2005, 10:37 PM   #2
maxfacta
Member
 
Registered: Aug 2004
Location: Perth, Australia
Distribution: Debian @ home + work :)
Posts: 66

Rep: Reputation: 20
From the context, I would assume that by 'console' you mean a terminal emulator runing under X, such as xterm or Eterm?
A lot of these programs can take an option of a program to execute in the window:

# xterm -e ticktack
# Eterm -e ticktack
 
Old 08-16-2005, 10:36 AM   #3
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 30
Re: script that opens the new console and does it's stuff in there

As I said, I want to just type ticktack, with instructions to be executed in another window placed in the script itself.

Last edited by frankie_DJ; 08-16-2005 at 11:14 AM.
 
Old 08-16-2005, 11:55 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
Code:
#!/bin/bash

xterm -e bash -c "
  trap 'echo clock killed; sleep 1; exit 1' 2
  while true
  do
    clear
    date +%r
    sleep 10
  done
"
 
Old 08-16-2005, 12:22 PM   #5
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 30
Thanks Hko, that works just as I want it. I read that option in the man pages, but didn't realize that that's what I am looking for. Cheers.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
fixing my console and stuff? slinky2004 Linux - General 4 09-16-2005 11:08 PM
When I try to download a script (.sh) or even other files, the browser opens it... pujolasdf Linux - Newbie 5 03-24-2005 01:49 PM
Oddnes console stuff dfownz Linux - General 5 05-10-2004 01:23 PM
make stuff run at startup (in a seperate console) Red Squirrel Linux - Newbie 7 03-04-2004 10:25 PM


All times are GMT -5. The time now is 03:45 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration