LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   This script in one line? (https://www.linuxquestions.org/questions/linux-newbie-8/this-script-in-one-line-292629/)

coder22 02-20-2005 12:12 PM

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

jlangelier 02-20-2005 12:15 PM

ls -l | grep ^d


All times are GMT -5. The time now is 06:38 PM.