Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Unanswered: NEWBI read question

    How do i make my read be on the same line as the prompt? Here is my sample code:

    #!/usr/bin/sh
    opt='1'
    while test "$opt" != "Q"
    do
    clear
    echo '1) Option'
    echo '2) Option'
    echo '3) Option'
    echo '4) Option'
    echo ''
    echo 'Enter your option now or Q ot quit >'
    read opt
    done

    This puts the read on the line below the echo but I want it after the angle bracket. Sorry to bother your ubernesses with trival code, but thanks if you reply.

  2. #2
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    Try this :
    Code:
    echo -n 'Enter your option now or Q ot quit >'
    and if this doesn't work (UNIX flavour dependant)
    Code:
    echo "Enter your option now or Q ot quit >\c"
    Jean-Pierre.

  3. #3
    Join Date
    Feb 2004
    Posts
    5
    Worked like a champ thanks.

Posting Permissions

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