Unidentified subject!
What is the best way to get the equivalent of the DOS command
"dir /ad" in linux? That command will show just the (sub)directories
and not ordinary files.
I thought that "ls -d" would be the equivalent but it is not.
I know I can do "ls -f | grep /" to get the directory, but putting it
into a script like this fails because the / does not appear when the
output of ls is redirected:
-----------------------------------
#!/bin/sh
if [ ! -z "$1" ]
then
WAAR=$1
else
WAAR=.
fi
ls -f $WAAR | grep /
----------------------------------
The following script works:
-----------------------------
#!/bin/sh
if [ ! -z "$1" ]
then
WAAR=$1
else
WAAR=.
fi
ls -la $WAAR | grep ^d
-----------------------------
Is there another way of doing this?
Johann
--
J.H. Spies - Tel. 082 782 0336. Posbus 4668, Tygervallei 7536
"But seek ye first the kingdom of God, and his
righteousness; and all these things shall be added
unto you." Matthew 6:33
Reply to: