Find the answer to your Linux question:
Results 1 to 3 of 3
Hello all. I'm pretty sure this will be simple for you guys, I'm still brand new to scripting. I needed to make a very simple program that takes four command ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2013
    Posts
    5

    Simple scripting program for class


    Hello all.

    I'm pretty sure this will be simple for you guys, I'm still brand new to scripting.

    I needed to make a very simple program that takes four command line parameters (in this case, names) and lists them. Then it's supposed to sort them. For now, I just want to get the parameters down.

    If you use anything other than four names, it's supposed to give you an error message. Here is my code:

    #!/bin/bash

    if [ $# < 4 ]
    then
    echo "You must enter four names only"
    if [ $# > 4 ]
    then
    echo "You must enter four names only"
    else
    echo You have entered these four names
    echo $1
    echo $2
    echo $3
    echo $4
    fi
    fi

    what am I doing wrong here?

    Thanks for your help...

    -MP-

  2. #2
    Just Joined!
    Join Date
    Feb 2013
    Posts
    5
    No need to reply...I figured it out (I just can't figure out how to delete my post...lol)

  3. #3
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Quote Originally Posted by Outsider418 View Post
    No need to reply...I figured it out (I just can't figure out how to delete my post...lol)
    Hello and welcome aboard!

    Regular users can't delete their own threads. You can find more on how the forums work (or don't work in some cases) at the following link:

    http://www.linuxforums.org/forum/lin...ember-faq.html
    oz

Posting Permissions

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