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 advantages of shell script?
How to add some content in any file at some desired location without using VI or some other editor in UNIX
what is the difference between cmp and diff commands
What is shell application?
What is a scripting language simple definition?
How do I open the shell in cmd?
What does echo $0 do?
Write a shell script in Linux to shift all characters in a file forward by five characters. (Thus “a” becomes “f’”).
2 Answers Ignou, Tripura Info,
How do I stop script errors?
How can you get the value of pi till a 100 decimal places?
What is difference between bash and shell?
What is a shell script in windows?