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 |
What are the different variables present in linux shell?
How do I stop script errors?
What is the best scripting language?
write a shell script to check the failed jobs?
Write a shell script to check whether a number is Armstrong number or not?
What are the various stages of a linux process it passes through?
What is c in shell script?
How to handle the delimiter unit seperator in Unix
What is bash command used for?
Why we are writting shell scripts? Plz if possible explain it briefly.
What are the different shells available?
How to redirect both standard output and standard error to the same location?