LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-20-2005, 12:12 PM   #1
coder22
LQ Newbie
 
Registered: Apr 2004
Location: AUSTRIA
Distribution: FC3
Posts: 14

Rep: Reputation: 0
This script in one line?


Hi all,

short question: How can I put this script in one line?
(just as I would type it in manually at bash (bourne again shell)

#!/bin/bash
# Script used for listing only directories
dir -1 | while read a;
do
if test -d "$a"
then
echo "$a"
fi
done

# dir -1 | .... ??? <--- ??

Thanks for help in advance,
would be great if anyone has good bash programming howto's.

coder22
 
Old 02-20-2005, 12:15 PM   #2
jlangelier
Member
 
Registered: Jun 2003
Location: Denver, CO
Distribution: Debian
Posts: 95

Rep: Reputation: 15
ls -l | grep ^d
 
  


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
bash shell script read file line by line. Darren[UoW] Programming 57 04-17-2016 06:07 PM
end of line script paul_mat Linux - Software 1 11-04-2005 01:06 AM
Need quick 1-line script help. mehesque Linux - Software 2 08-24-2005 02:18 PM
Loop line by line script twantrd Programming 7 01-16-2005 11:47 PM
/r at end of line in script silence Linux - General 1 08-21-2004 08:25 AM

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

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