Create text file from BASH script and write to it.

Posted on 2007-08-02
Last Modified: 2012-06-27
Really quick question for the linux BASH shell (making a BASH script).

How do I create a text file ($strFilename)  and how do I append a line of text ($strText) into it?

Thanks guys
Question by:Ryan_R
    LVL 51

    Accepted Solution

    > How do I create a text file ..
    touch filename

    > .. and how do I append a line of text  into it?
    echo strText >> filename
    LVL 15

    Author Comment

    Thanks hoff :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
    This article will show, step by step, how to integrate R code into a R Sweave document
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now