Results 1 to 7 of 7

Thread: Command line text with .sh

  1. #1
    Join Date
    Mar 2010
    Posts
    200

    Command line text with .sh

    Hello,
    I created a mini-program in a bash registered test.sh. I add a command line that displays a sentence in the console before saving to a text file. That would be something like
    Code:
    command 'my words'>> file.txt
    Except that I do not know this famous command and my research is not very successful. Any help regarding this will be appreciated. Thank you for your help.

  2. #2
    Join Date
    Apr 2008
    Posts
    240

    Re: Command line text with .sh

    Hello,
    Even i am trying something similar to this. But it is likely that it quickly became a subject of TP, since we start with the basics of UNIX history to be comfortable in this environment. It is the echo command. I thought that this command does that walked for another command, but it also works for displaying messages. And most incredible is that the same windows (except that Windows does not differentiate between> and>> and always writes over what is already in the text file). Long live Linux, OS X vivid, lively UNIX.

  3. #3
    Join Date
    Nov 2009
    Posts
    583

    Re: Command line text with .sh

    Hello,
    I think this is what you are looking for. To view your sentence in the console you would type:
    Here is the code for it
    Code:
    echo "your sentence"
    Then to your sentence in a file:
    HTML Code:
    echo "your sentence"> test.txt
    This is it. You will see the sentence in your file on the terminal.

  4. #4
    Join Date
    Nov 2009
    Posts
    333

    Re: Command line text with .sh

    Hello,
    I agree with the above post and would like to give you an example. Now if you need your sentence in many cases, you can create a variable in early test file: x is the variable
    Here is the code
    Code:
    x = $ 1
    has the sh file in your execution, it will ask you to write your words in the terminal
    Here is the it
    Code:
    echo what sentence you want to write? "read x
    and then DPNC:
    Here is the result
    Code:
    echo $ x> test.txt
    I hope this will help you.

  5. #5
    Join Date
    Mar 2010
    Posts
    200

    Re: Command line text with .sh

    Hello,
    I have another question. I ask the basics: I have a text file with a list of words one below the other, I'm not going to do a drawing, it looks like a list of words (one per line) one above the other . How can I make a small file (bash of course) that I remove all duplicate words, triple, or more so it remains one of each? I know it's a little more complicated than the first question, but your help would be welcome.

  6. #6
    Join Date
    Nov 2009
    Posts
    583

    Re: Command line text with .sh

    Hello,
    You will notice that I put out first and uniq if you would. There's no need quotes around file names unless there is special car and you want to make you shit but to bash escape escaper itself when you use the autocompletion (tab) and then the file name with special char is bad.

  7. #7
    Join Date
    Mar 2010
    Posts
    200

    Re: Command line text with .sh

    Hello,
    I created a little script that backs up any animal on two different drives all my iPhoto. It is limited to a few lines of explanation of what happens like "backup to disk 1". This script works very well and deserves to back up all my photos a simple click from the dock icon. But I'm picky, I would like to see where the progress of the copy and why I have the wonderful ls command to display the size of a and file and goto sleep command that will allow me to create a loop to update from time to time. Any help is appreciated.

Similar Threads

  1. xcopy command line together with wmplayer command line
    By Aislinn in forum Operating Systems
    Replies: 5
    Last Post: 31-03-2010, 12:13 PM
  2. Replies: 3
    Last Post: 03-09-2009, 05:41 PM
  3. How to let Java read text file line by line.
    By Visala28 in forum Software Development
    Replies: 3
    Last Post: 04-08-2009, 11:30 PM
  4. Command Line Ren (Rename) command broken?
    By SixSigmaGuy in forum Vista Help
    Replies: 2
    Last Post: 18-05-2008, 03:30 PM
  5. Replies: 1
    Last Post: 18-05-2007, 01:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,727,412,173.46445 seconds with 17 queries