Results 1 to 5 of 5
  1. #1
    Now that is cool!
    V6Pony's Avatar
    Member Since
    Oct 30, 2010
    Location
    Southern Illinois
    Posts
    273
    Specs:
    MBP 15" I7 first one and loving it.
    Now that is cool!
    #!/bin/bash
    echo "Enter lower case text here"
    read foo
    var=`echo $foo | tr "{a-z}" "{A-Z}"`
    # {a-z} Matches a through z
    # {A-Z} matches A through Z
    echo $var

    but I'm not sure I fully understand ` ` I think it allows the output from an application to be stored in a variable. In this example the output from echo $foo | tr "{a-z}" "{A-Z}" is saved in var. So what does tr do? Change lower case to upper case. Why does it do that?

    The tr utility copies the given input to produced the output with substitution or deletion of selected characters. tr abbreviated as translate or transliterate. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set i.e. it is used to translate characters.

  2. #2
    Now that is cool!
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,395
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    It's called command substitution (see 3.4.5 here for more info).

    Looks like you're progressing well!
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3
    Now that is cool!
    Slydude's Avatar
    Member Since
    Nov 15, 2009
    Location
    North Louisiana, USA
    Posts
    8,552
    Specs:
    2.8 GHz MacBook Pro 10.10.2, 8 GB mem, iPhone 6+
    /Slydide trembles in fear as he bookmarks bash guide for future use.
    Sylvester Roque Former Contributing Editor About This Particular Macintosh

    "Got Time to breathe. You got time for music." Denver Pyle as Briscoe Darling

  4. #4
    Now that is cool!
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,395
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    That would be wise. Someday the blog will be powered by bash scripts...
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5
    Now that is cool!
    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,821
    Specs:
    Way... way too many specs to list.
    Quote Originally Posted by vansmith View Post
    That would be wise. Someday the blog will be powered by bash scripts...
    sed 's/bash/ksh/g'

    mike
    This machine kills fascists
    Got # ? phear the command line!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How cool is this?
    By mcbrew in forum Switcher Hangout
    Replies: 3
    Last Post: 03-10-2011, 03:35 PM
  2. How does it keep cool?
    By mikesmith2 in forum Apple Notebooks
    Replies: 8
    Last Post: 12-16-2007, 05:36 PM
  3. Anyone else think that this is cool?
    By Martin. in forum iPod Hardware and Accessories
    Replies: 2
    Last Post: 09-21-2007, 04:05 AM
  4. This Is Cool
    By chrisb2999 in forum OS X - Operating System
    Replies: 0
    Last Post: 01-28-2006, 02:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •