soleblazer
01-02-2004, 02:51 PM
Greetings,
I am sure this is easy, but I am having brain fry today.
I want to write a simple alias that will only display the directories in a location.
I realize that there are many ways to do this, but I went do the road of doing something like:
for i in `ls -l`
do
if [[ $i starts with d ]]
then
echo $i
fi
done
Now, my question is, how can I do the part with the "if $i begins with d" part.
I realize I could probably do something with awk (slicing the first letter off), but is there a easy way to do this with regexp? maybe iwth the ^ ???
Tks, this is more of a learning thing for me now.
I am sure this is easy, but I am having brain fry today.
I want to write a simple alias that will only display the directories in a location.
I realize that there are many ways to do this, but I went do the road of doing something like:
for i in `ls -l`
do
if [[ $i starts with d ]]
then
echo $i
fi
done
Now, my question is, how can I do the part with the "if $i begins with d" part.
I realize I could probably do something with awk (slicing the first letter off), but is there a easy way to do this with regexp? maybe iwth the ^ ???
Tks, this is more of a learning thing for me now.