What is "test"? How it is used in shell scripting?
Answers were Sorted based on User's Feedback
Answer / madhavi
test is used to validate an expression in shell script.
for ex:in if loop ,is used as follows
if test a > b
{
#some statements
}
fi
instead of
if [ a > b ]
{
#some statements
}
fi
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
How to make userdefined variables to available for all other shells?
What does echo mean in scripting?
Why is a script important?
write a shell program to check wheather a given string is pallindrome or not?
When should shell programming/scripting not be used?
In which variable prompt value is stored?
I have 2 files and I want to print the records which are common to both.
Can shell script run on windows?
In shell scripting if text is surrounded by single quotes what does it denotes?
What is a shell? · Types of shell · what is shell scripting?
how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
What are the different types of variables used in shell script?