Answer Posted / swaroopa
The test command is particularly useful in this context
allowing a variety of conditions to be checked for. There
are two equivalent syntaxes.
test expression
and
[ expression ]
The following simple example will list all the
subdirectories of the current directory.
for i in *
do
if [ -d $i ]
then
echo $i
fi
done
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
How to check if a directory exists?
What is bash eval?
What is difference between shell and bash scripting?
What is gui scripting?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.
What does sh mean?
What is a shell in operating system?
What is a shell script in windows?
What is @echo off?
What is a shell made of?
How does shell scripting work?
Write a script to print the first 10 elements of fibonacci series.
What are zombie processes?
How to get script name inside a script?
How do I run a shell script on a mac?