In: Computer Science
Write a bash shell script that takes exactly one argument, a file name. If the number of arguments is more or less than one, print a usage message. If the argument is not a file name, print another message. For the given file, print on the screen its content.
#!/bin/bash
usage()
{
echo "./script <filename>"
}
if [ $# -ne 1 ]
then
usage
exit 1
elif [ ! -f $1 ]
then
echo "Provide regular file only no directory or
anything"
else
cat $1
fi
if you have any doubt then please ask me without any hesitation in
the comment section below , if you like my answer then please
thumbs up for the answer , before giving thumbs down please discuss
the question it may possible that we may understand the question
different way and i can edit and change the answers if you argue,
thanks :)