What is "test"? How it is used in shell scripting?

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


Please Help Members By Posting Answers For Below Questions

How will you emulate wc –l using awk?

904


What does $$ mean in shell script?

575


What's the difference between scripting and coding?

593


What can scripts do?

660


What is shell scripting used for?

569






What are zombie processes?

569


Why is a script important?

559


What does debug script mean?

545


How do I save a powershell script?

553


What is in a script?

562


What is a program shell?

566


What is shell application?

567


What exactly is a shell?

598


What is the first line in a shell script?

553


How do I run a powershell script?

573