Find the answer to your Linux question:
Results 1 to 8 of 8
would anyone know what is the difference in these two commands? $ cat xyz[12] $ cat xyz[1-2]...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    11

    command help

    would anyone know what is the difference in these two commands?
    $ cat xyz[12]
    $ cat xyz[1-2]

  2. #2
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    The results of these two commands (in this case) are identical. You can refer to A Brief Introduction to Regular Expressions for more info.

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    11
    thanks how about these:

    $ grep -c ill memo

    $ grep -n ill memo

  4. #4
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    man grep
    then in the man page, enter
    /-c,
    for explanation of option c;
    then
    /-n,
    for explanation of option n

  5. #5
    Just Joined!
    Join Date
    Feb 2009
    Posts
    11
    thanks what about this script - im stuck!

    Write a script that will prompt for the user’s first name and store it in a variable. Then prompt for the last name and store it in a variable. Finally, display the stored information in the format “You entered lastname, firstname” and ask the user for confirmation. If the answer is “y” or “yes” then say “Thank you!” if the answer is “n” or “no” then start again with the prompts.

    #!/bin/bash
    declare FName
    read -p "Enter First Name : " FName

    declare LName
    read -p "Enter Last Name : " LName
    echo "you entered" $FName $LName

    read -p "Is that correct?"
    if [[ $YesNo = "Y,Yes" ]]
    then
    echo "Thankyou"

    else
    [[ $YesNo = "N,No" ]]




    fi

  6. #6
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    I'm pretty sure there are more than one way to accomplish this, here's one
    Code:
    #!/bin/bash
    ans=''
    while [ "$ans" !=  'Y' -a "$ans" != "YES" ]; do
        read -p "Enter First Name: " FName
        read -p "Enter Last Name: " LName
        echo "you entered: $FName $LName"
        read -p "Is that correct? (Y/N)" ans
        ans=`echo $ans|tr "[:lower:]" "[:upper:]"`
        case $ans  in
            Y|YES)
                echo "Thank you $FName $LName."
                ;;
            *)
                echo "Let's try again"
                ;;
        esac
    done

  7. #7
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695

  8. #8
    Just Joined!
    Join Date
    Feb 2009
    Posts
    11
    thanks man! its not homework - im taking a course for work -

Posting Permissions

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