Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    84

    Unanswered: Division in Shell Script

    Hi,
    I need help on getting $1 divided by $2 in a shell script.
    How to do that?
    Thanks for any suggestions

  2. #2
    Join Date
    Dec 2003
    Posts
    56
    use the expr command

  3. #3
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Originally posted by TimoV
    use the expr command
    'expr' will only perform integer arithmetic. I'd use awk...

    echo 3 2 | awk '{print $1/$2}'

Posting Permissions

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