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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-19-2003, 10:47 PM
|
#1
|
Member
Registered: Apr 2003
Posts: 41
Rep:
|
.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
|
|
|
08-19-2003, 11:02 PM
|
#2
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Rep:
|
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
|
|
|
08-20-2003, 02:17 AM
|
#3
|
Member
Registered: Oct 2002
Distribution: MDK 9.2, Debian
Posts: 74
Rep:
|
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.
|
|
|
08-20-2003, 08:32 PM
|
#4
|
Member
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289
Rep:
|
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.
|
|
|
08-20-2003, 10:02 PM
|
#5
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Rep:
|
oooh, I like that, ahve to remember that one
|
|
|
08-21-2003, 01:51 AM
|
#6
|
Member
Registered: Apr 2003
Posts: 41
Original Poster
Rep:
|
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!
|
|
|
08-21-2003, 09:42 AM
|
#7
|
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 01:53 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|