LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-21-2010, 01:47 AM   #1
ravibhure
Member
 
Registered: May 2007
Posts: 75

Rep: Reputation: 15
exit from subshell


Hi,
I have wrote one subshell script to use ftp in my env, but I am not able to exit from the subshell loop even I use function exit here, anybody help me to exit from the subshell, I am not sure but if we use array into loop it will exit but how I can use.

#!/bin/bash
if [ "$#" != "1" ]
then
echo
echo "Usage: $0 <my group> "
echo "Example: $0 files "
echo
exit 1
fi
exit() {
echo ByeBye
break
}
while :
do
echo -n "MYFTP> " | tee -a $MYFTP_LOG_FILE
read myftp_cmd
eval $myftp_cmd 2>&1 | tee -a $MYFTP_LOG_FILE
echo
done
 
Old 04-21-2010, 02:02 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,516

Rep: Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893
I am not sure where your confusion is?
You created an infinite loop with
Quote:
while :
and never use anything within the loop to stop looping.
 
Old 04-21-2010, 02:08 AM   #3
ravibhure
Member
 
Registered: May 2007
Posts: 75

Original Poster
Rep: Reputation: 15
Yes Grail,
I want to stop looping the subshell when type 'exit' command on subshell promp, so How can I handle the code regarding to exit or stop the looping.
 
  


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
does the `( )' create a subshell? tianlijian Linux - Newbie 1 04-19-2009 07:39 AM
Help, with subshell I think? :S DjRakso Linux - Newbie 3 10-28-2007 03:24 PM
Warning: at kernel/exit.c:814 do exit() (Tainted: P ) <- nVidia video problem? Hitboxx Fedora 2 10-06-2007 09:47 PM
mc subshell.c: read (subshell_pty...): rickenbacherus Linux - Software 2 07-14-2004 07:14 PM
Continuing a script on a new subshell dpillay Programming 2 05-29-2004 07:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration