Need help with Unix assignmet

Hi i am a newbie to UNIX and i am undertaking a course, i have some exercises and one of them is as follows:

Create a file with x amount of lines in it, the content of your choice.
Write a script named 'firstline' that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.

Assume the file is called �textfile1� and has the contents
Text one
Text two
Text three
.
.
.
.
Text n

How do i redirect a variable that hold text (or a string of characters) to the 1st line of the file, without effect the current 1st line.

The variable doesn�t need any input from the user, so it assume it will be as follows:
Mytext=�hello people� this being the 1st argument $1

Not I am NOT permitted to use either SED or AWK.

i am not looking for the full answer please, just a hint on how to start this, i am trying to learn after all :slight_smile:

Any help will be greatly appreciated.

i managed to do some of it, but i am not sure if it is the right way of doing it.

echo "new text" > tmp
cat $file >> tmp
mv tmp $file

$file is a variable pointing to the a file

is what i am doing right? if not can you please give me a reason why and how i should do it?

thanks again

i have figured it out, please dont reply to this post.

thanks