Passing filename as parameter and displaying the file contents

Hi All,

Its extremely urgent regarding the following requirement.
I have created few files in a directory. I have write a program in shell scripting such that it prompts for the filename . once the filename is entered,it should print the contents of the file.

Can anyone help with this......... Its extremely urgent.

Can you show us what have you tried so far and where you are stuck?

Regards

a very simple script matches your requirement:

#!/bin/bash

echo "filename ???"
read fn

for f in $fn
 do
   cat $f
done

Can you post your code please?
How do you want the file's content to be printed? in the terminal (in this case maybe a "more file.txt" could do)?

So now we are making homework for others?

Regards

Thanks for the replies

this is very short.

#!/bin/sh

read file
cat $file

@ Franklin52 : sorry, i posted the solution at the same time as your post so ...
I'll pay attention next time.