LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-19-2003, 11:47 PM   #1
slooper
Member
 
Registered: Apr 2003
Posts: 41

Rep: Reputation: 15
.sh script pops up terminal, but won't stay up!!!


I have a bash script that is linked to an application launcher on my desktop. I am trying to get it to launch the pure-ftpwho -v command as root and keep the konsole window up so I can view the results. As it stands now, the window closes as soon as the script completes. How do I keep the window up? Is it a line of scripting I need to add or a setting in the shortcut itself? I've already searched through the forums but to no avail.

Here is the script...

#!/bin/bash
/usr/local/sbin/pure-ftpwho -v


-sean
 
Old 08-20-2003, 12:02 AM   #2
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
add this to the bottom of the script:

echo "Command has finished"
sleep 10s
#change 10 to whatever number of seconds you want, or change s to m for minuts.

or if you want you can have the command output all data to a textfile rather than the screen like this:
/usr/local/sbin/pure-ftpwho -v > sometextfile.txt
 
Old 08-20-2003, 03:17 AM   #3
Read_Icculus
Member
 
Registered: Oct 2002
Distribution: MDK 9.2, Debian
Posts: 74

Rep: Reputation: 16
Or you could pipe the output through another command like my favorite pager, "less".

This command will display the output of "pure-ftpwho -v" through less, which is essentialy the same as navigating a man page.

/usr/local/sbin/pure-ftpwho -v | less

So hitting the "q" key will exit the script. A simple CTRL+C will exit the script if you use sleep in place of less, but I like less as an alternative as it's one less button to exit and you can browse through multiple screens of output.
 
Old 08-20-2003, 09:32 PM   #4
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Rep: Reputation: 30
You could also put a "read" statement within your script that says something like :


echo "Press any key to continue..."
read $JUNK

This will pause your script til you hit enter.
 
Old 08-20-2003, 11:02 PM   #5
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
oooh, I like that, ahve to remember that one
 
Old 08-21-2003, 02:51 AM   #6
slooper
Member
 
Registered: Apr 2003
Posts: 41

Original Poster
Rep: Reputation: 15
awesome! that's working great...now how about this:

Can I add a loop function to this with some sort of time delay, ie once every minute or so as well as a 'clear' command?

Like this:

#!/bin/bash

if (Enter is pressed){
close window;
}

else {
loop {
clear screen;
/usr/local/sbin/pure-ftpwho -v;
wait 1 minute;
}
}


Please forgive my weak programming. I don't know how to script in Bash, just MEL, but I'm sure you get the idea. Basically, I want a self-updating monitor for who is on my ftp server

fun stuff!
 
Old 08-21-2003, 10:42 AM   #7
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
I do not know about the enter pressed thig, but try this:

#/bin/sh
while [ 0 -eq 0 ]; do
clear
/usr/local/sbin/pure-ftpwho -v
sleep 60s
done

to exit it hold control and press c
 
  


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



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 11:34 AM
problem with the terminal and a shell script LinuxPadawan Linux - General 1 05-17-2005 11:29 PM
is there a script that controls what happens when you switch a terminal? Fascistchicken Linux - General 2 09-29-2004 11:11 PM
gnome-terminal launcher script Mur Linux - Software 0 04-26-2004 11:43 AM
How to make a PATH stay in the environmental variables after closing the terminal.... jmax24 Linux - General 4 04-19-2004 12:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:11 AM.

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