Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

arguments

  • 21-08-2007 08:52PM
    #1
    Closed Accounts Posts: 91 ✭✭


    Ok so i had to create a file and put some random text into it which i did.

    THen u make a script which takes 2 arguments.

    The first being a line of text, the second being your newly created file.

    Can I just use a read the first line in using echo?

    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.

    How do I do the second bit, it keeps putting the first argument at the bottom of the file.


Comments

  • Technology & Internet Moderators Posts: 28,862 Mod ✭✭✭✭oscarBravo


    Homework?


  • Closed Accounts Posts: 91 ✭✭magnia


    have to learn unix for a job im applying for


  • Closed Accounts Posts: 91 ✭✭magnia


    ive got this so far

    BUFF=$(cat $2) echo $1 >> $2 echo " $BUFF" >> $2

    but im getting the wrong output

    "Seamus Heaney was born in April 1939, the eldest member of a family which would eventually contain nine children.


    unixisbrillant echo"

    i need to get the lastline at the top


Advertisement