Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Positional Parameters help


    So I'm learning the shell off of linuxcommand .org and I am stuck on positional parameters, I am stuck here...
    Command line options

    As we discussed before, many programs, particularly ones from the GNU Project, support both short and long command line options. For example, to display a help message for many of these programs, you may use either the "-h" option or the longer "--help" option. Long option names are typically preceded by a double dash. We will adopt this convention for our scripts.

    Here is the code we will use to process our command line:

    interactive=
    filename=~/system_page.html

    while [ "$1" != "" ]; do
    case $1 in
    -f | --file ) shift
    filename=$1
    ;;
    -i | --interactive ) interactive=1
    ;;
    -h | --help ) usage
    exit
    ;;
    * ) usage
    exit 1
    esac
    shift
    done

    I tried putting #!/bin/bash on the top to get the bash to run it and also tried putting a file where it says system_page.html but nothing, some elaboration would be great, thanks.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    What is your question? What are you trying to do? What error message are you getting?

  3. #3
    Sorry I misunderstood what the lesson was telling me and I figured it out, thanks anyways!

  4. $spacer_open
    $spacer_close

Posting Permissions

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