CHRIST MCA 2009-2012
Would you like to react to this message? Create an account in a few clicks or log in to continue.

32. WASS to accept 2 file names if both exits and not empty then concatenate both and store the content in a file called merged.txt

Go down

32. WASS to accept 2 file names if both exits and not empty  then concatenate both and store the content in a file called merged.txt Empty 32. WASS to accept 2 file names if both exits and not empty then concatenate both and store the content in a file called merged.txt

Post  1987ronnie Wed Jul 21, 2010 12:01 am

clear
count=0
echo "Enter a filename:"
read file1
if test -s file1
then
echo "File exists and is non-empty"
count=`expr $count + 1`
else
echo "File doesn't exist"
fi

echo "Enter another filename:"
read file2
if test -s file2
then
echo "File exists and is non-empty"
count=`expr $count + 1`
else
echo "File doesn't exist"
fi

if test $count=2
then
cat file1 file2 > merge.txt
fi

Rolling Eyes Laughing Smile

1987ronnie

Posts : 3
Join date : 2010-07-20

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum