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 do I save a powershell script?
What does .sh file contain?
How do scripts work?
What is the use of "$?" Sign in shell script?
What is the conditional statement in shell scripting?
How to print all array elements and their respective indexes?
how to read systems current date and time
Why are shell scripts used?
What is bash used for?
Differentiate between ‘ and ” quotes.
What is sh in shell script?
What command needs to be used to take the backup?