Pages

Text

Recent Articles

Nike Sports

Ads 468x60px

Recent Posts

Google Plus

Download

Thursday, 12 April 2012

Write a shell script to check wether the file exist in the current directory, if the file exist then display the contents of the file else display the file not found in the current directory.

#! /bin/sh
# Write a shell script to check wether the file exist in the current directory, if  the file exist then display the contents of the file else display the file not found in the current directory.
echo "Enter the file name "
read file
if ls $file
then
cat $file
else
echo "The given file is not found in current directory "
fi

0 comments:

Post a Comment