Red HatThis forum is for the discussion of Red Hat Linux.
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.
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.
I had a try to test the script filecheck as below.
$> filecheck&
$>
the script content of filecheck is:
#!/bin/csh
echo "hello"
the result is:
$> hello
_ (the curose is here, waiting for user input but not $>)
the questions are:
1. why the linux is under waiting for input status but not the system prompt status?
2. how to get the $> prompt after launching $> filecheck&
thanks. Aug 22, 2007
Last edited by linux_1; 08-22-2007 at 05:27 AM.
Reason: add another question
The script finished running in the background, the shell is just waiting for any more commands to process. Run 'filecheck & sleep 1s' or 'filecheck &' and give an enter and you'll see what I mean.
Is it possible to write something in the script in order to get the $> automatically? Or it is the limitation of the O.S.
this question is from another try on this is as below.
(script)
#!/bin/csh
#the filename is delcheck.
# purpose is to check if the file exist.
#if yes, check the status, sleep 5 seconds.
#if the file is removed,
@ i = 1
while (i != 0)
test -e $1
if ($? == 0) sleep 5
else
echo "the file $1 does not exist."; exit
endif
end
then I launched the script sa below. hhh is a file in the same folder.
$> delcheck hhh&
$> rm hhh
the result is
$> the file hhh does not exist.
_ (cursor is here. waiting for command or hit enter)
Is it possible to write something in the script in order to get the $> automatically?
How do I put this... You explicitly put it in the background, so you know you can expect that behaviour. If you don't want that, then simply don't put the job in the background. If you put it in the background to get your screen back maybe use 'screen' instead. If you put it in the background because the file to delete is large and you can't wait for it, maybe make deleting the file an 'at' job instead. Maybe you could tell me what the goal of this exercise is? What are you trying to accomplish? And who or what forces you to use Csh?
I did this exercise just following my curiosity when I learnt lauching script in background.
Ah, OK, I see. Good luck with the shell learning thing then. It's definately valuable.
Thank you, Chrism01.
I tried the command in Red Hat Linux Enterprise O.S, no difference between them.
It may be a good habit within Linux (I am a newbie as the title indicated by the system here :-< )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.