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 03-01-2008, 11:58 AM   #1
SpLaSh212
Member
 
Registered: Mar 2006
Posts: 42

Rep: Reputation: 15
A simple for loop in the prompt ?


Hey,
I wanted to know how I can run, for example the following shell script, in the prompt line

Code:
for i in `ls`
do
     echo -n "$i: "
done
I want to be able to run it from the prompt ...
How can I do this ? :\

thnx alot !

Last edited by SpLaSh212; 03-01-2008 at 11:59 AM.
 
Old 03-01-2008, 12:05 PM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
Code:
 for i in `ls`; do echo -n "${i}: "; done
or just type it in exactly as you have it
 
Old 03-01-2008, 12:11 PM   #3
SpLaSh212
Member
 
Registered: Mar 2006
Posts: 42

Original Poster
Rep: Reputation: 15
OK !
Thanks !, my mistake was that I thought that after the "do" I also need to put ; or \ or something !

thnx alot
I believe that this thread can be deleted now :0
 
  


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
Help with simple loop program in C Exsiss Programming 7 10-10-2007 07:48 AM
[c shell] simple for loop saiz66 Programming 1 09-28-2004 08:02 PM
Simple for loop lappen Programming 10 09-26-2004 07:36 AM
login prompt loop with Suse Live CD hrp2171 Linux - General 0 09-08-2004 08:22 PM
prompt to GUI loop PhuzzyLogic Linux - Newbie 3 06-20-2003 09:26 AM

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

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