What is the use of "test" command?

Answer Posted / satchi

"Test" command checks file and directory types and checks
value.

EX: create a empty file test (touch test)

if test -f test
then
echo "File is nonempty"
else
echo "file is empty"
fi


There are different options like -d -b -e.You can explore
all.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of using shell scripts?

806


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

2248


What is shell variable?

697


What is bash command used for?

774


What is difference between bash and shell?

748


What is sh in shell script?

748


Can shell script run on windows?

761


Print the 10th line without using tail and head command.

1947


State the advantages of shell scripting?

811


What is k shell?

725


Differentiate between ‘ and ” quotes.

798


What is the use of "$#" in shell scripting?

738


What is the default ubuntu terminal?

820


What happens when you type ls?

752


How to print all the arguments provided to the script?

763