LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 01: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, 01:15 PM   #2
jlangelier
Member
 
Registered: Jun 2003
Location: Denver, CO
Distribution: Debian
Posts: 95

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


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


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