OSA B15

 B15.Write a shell program to convert all lowercase letter in a file to uppercase    letter. 

Program:

#!/bin/bash
# get filename
echo -n "Enter File Name : "
read fileName

# make sure file exits for reading
if [ ! -f $fileName ]; then
  echo "Filename $fileName does not exists"
  exit 1
fi

# convert lowercase to uppercase using tr command
tr '[a-z]' '[A-Z]' < $fileName

0 comments:

Post a Comment