LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 01-30-2007, 04:12 PM   #1
Keentolearn
LQ Newbie
 
Registered: Jan 2007
Posts: 3

Rep: Reputation: 0
Looping a script


Is there a way that the user can re use the script with out opening it?

using and if statement for example

echo "Would you like to run this script again Y/N"
read answer
if answer="Y"
then
.....
else
exit
fi

Regards.
 
Old 01-30-2007, 04:29 PM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,899

Rep: Reputation: 68
Read man bash, really.

REPEAT=Y
while [ "REPEAT" = Y ]; do
...
echo "Would you like to run this script again Y/N";
read REPEAT;
done;
 
Old 01-30-2007, 04:34 PM   #3
Keentolearn
LQ Newbie
 
Registered: Jan 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you very much.
 
Old 01-30-2007, 04:47 PM   #4
bogzab
Member
 
Registered: Mar 2006
Location: Dyserth, Wales
Distribution: Slackware 14.0, Slackware 14.1, Slackware-current
Posts: 306

Rep: Reputation: 33
Actually man bash is pretty impenetrable. You might prefer to start with one of the many bash tutorials that are around the web. One is http://www-128.ibm.com/developerwork...ry/l-bash.html

Bogus
 
Old 01-30-2007, 04:54 PM   #5
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,899

Rep: Reputation: 68
Well, why do you undermine self-confidence of someone who hasn't yet tried? Man bash is not impenetrable - I read it having knowledge level no higher than Keentolearn's one, I guess. Really both man bash and info bash are rather compressed, and are close derivatives of POSIX standard for shell. But they can be read - at least when you believe in yourself.
 
  


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
Looping a bash script SoulGrind Linux - Newbie 5 09-22-2006 07:03 PM
login looping plaircpa Slackware 3 10-31-2005 09:10 PM
shell script looping ust Linux - General 2 01-19-2005 05:05 AM
looping in mplayer zexter Linux - Software 1 12-22-2003 05:39 PM
[C] for looping problem wuck Programming 6 10-19-2003 05:29 PM


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