Possible Solution to Question 1
Posted on 2007-10-04
i asked questions before with no knowledge of shell scripting/ variables. But i have read some information on it and have come up with a solution. I do not whelther it' s right or not but i need help with it.
This is the question
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.
Note! The file must retain the original name
Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file. Please note that no matter how many lines there are in your script it should always place the line of text in the middle. Name this script 'middleline'.
Note! Again the original file must retain it original name
The situation is that i have a script and a solution and it doesnt input what i except
variable=$(wc -l file | cut -f1 -d' ')
If I ruled the world Imagine that
I'd free all my sons,I love em love em baby
Black diamonds and pearls
Could it be, if you could be mine, we'd both shine
If I ruled the world
Still livin for today, in these last days and times
Help anyone please!!