LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 10-31-2007, 07:26 AM   #1
Chets
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
Executing another script from xterm


HI,
I am trying to execute another script from xterm using -e option.
but whenever i run xterm -e script-filename one window flashes and went off in sec.
don't know what is the problem here...

just to check this created a script which shows date,time and lists files
eg: date.sh:
#!/usr/bin/bash
echo `date`
echo `time`
exec ls

running this script from shell works fine.

but executing same script from xterm fails.
xterm -e date.sh --> pops up window and closes (window does not remains)

even tried with this xterm -e date.sh & --> same observation

need help in this, i want new terminal to remain and execute the script.
 
Old 10-31-2007, 08:22 AM   #2
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 17
Posts: 150

Rep: Reputation: 18
As soon as the last command executes, it is closing the window. Try a sleep statement if you want the window to remain up for a certain amount of time. You can also try putting a read statement at the end. That should make it wait for some user-input before closing.
 
Old 10-31-2007, 08:38 AM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Ypu can alos use the -hold option which will keep the xterm open until you click it away.
 
Old 11-01-2007, 04:17 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
try...

Code:
xterm -e ksh -c 'date && read'       # stay up until you press return
xterm -e ksh -c 'date && sleep 10'   # stay up 10 seconds
(or bash if you prefer of course)
 
Old 11-01-2007, 05:19 AM   #5
Chets
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you all for ur response...

i got it what i need with -hold option.
eg:

xterm -hold -e /bin/bash date.sh
 
Old 11-01-2007, 05:40 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
yes, but -hold is not standard xterm so it won't work on solaris, say
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing an application via xterm g4j31a5 Linux - Software 3 02-20-2007 11:16 AM
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 05:05 PM
executing a script!! vishamr2000 Linux - Security 5 07-29-2005 02:34 AM
Executing install script for ... securehack Linux - Software 6 05-24-2005 11:02 AM
Script is not executing in Apache!!! linux_child001 Linux - Newbie 1 06-22-2004 05:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration