LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 08-22-2007, 05:24 AM   #1
linux_1
LQ Newbie
 
Registered: Aug 2007
Posts: 12

Rep: Reputation: 0
how to get the linux prompt ??


Hello, here comes a linux fans.

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
 
Old 08-22-2007, 05:59 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 08-23-2007, 02:41 AM   #3
linux_1
LQ Newbie
 
Registered: Aug 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you, unSpawn. I saw the result.

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)


any comment is appreciated.
 
Old 08-23-2007, 05:20 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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?
 
Old 08-23-2007, 08:03 AM   #5
linux_1
LQ Newbie
 
Registered: Aug 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks again, unSpawn.
I did this exercise just following my curiosity when I learnt lauching script in background.

Yes, you brought a good idea. I may do the exercise according to the actual requirement in daily work.

Have a nice evening.
 
Old 08-23-2007, 04:09 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 08-24-2007, 09:22 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Is this a good time to point out that there has to be a <space> char between the cmd name and the '&' char? ie
filecheck &
not
filecheck&
 
Old 08-25-2007, 07:44 AM   #8
linux_1
LQ Newbie
 
Registered: Aug 2007
Posts: 12

Original Poster
Rep: Reputation: 0
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 :-< )

Have a nice day.
 
  


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
how to configure GUI from linux prompt mediaworld Linux - Newbie 2 05-25-2006 12:08 PM
Why my linux does not bring the password prompt...? chekulo Linux - General 3 05-18-2006 01:45 AM
Booting Linux From Command Prompt ??? shandy Linux - Software 3 11-04-2005 11:23 AM
Linux Crashed Could not get # or $ prompt jspsandhu Linux - Software 1 06-24-2005 11:02 PM
linux prompt(really newbie question) blackzone Linux - Newbie 5 08-05-2004 12:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 04:25 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