LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2002, 06:07 PM   #1
frost33
LQ Newbie
 
Registered: May 2001
Posts: 7

Rep: Reputation: 0
Angry quick bash help!


Okay... quick shell programming question here.

In /foo there are several directories/files :

this is one directory
this is another
justafile.txt

I want :

for i in $(ls $(pwd)); do
echo $i
done

To return :

this is one directory
this is another

Instead it returns :

this
is
one
directory
this
is
another
justafile.txt

Any help would be much appreciated!

Thanks!
 
Old 11-14-2002, 06:19 PM   #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
ls $(pwd))| while read i; do
echo "$i"
done
 
Old 11-14-2002, 06:24 PM   #3
frost33
LQ Newbie
 
Registered: May 2001
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks!
 
  


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
quick bash script to convert flac to mp3 zuralin Programming 8 08-19-2011 03:50 AM
Quick bash help Aphex_Twin2 Linux - General 5 05-23-2005 10:59 AM
Quick bash question neocytrix Programming 8 07-30-2004 10:23 PM
really quick bash question fibbi Linux - Software 3 06-15-2004 10:14 PM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 06:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:41 AM.

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