Find the answer to your Linux question:
Results 1 to 4 of 4
ok if i write 1+1 in prompz i get error message....is possible to use "calculator" in bash (like in python shell)...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549

    bash calc


    ok if i write 1+1 in prompz i get error message....is possible to use "calculator" in bash (like in python shell)

  2. #2
    Just Joined!
    Join Date
    Nov 2006
    Posts
    45
    expr 1 + 1

    bash does not have builtin math functions like python or perl

  3. #3
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    You could potentially use a sort of built-in Bash utility:
    Code:
    echo $[1 + 1]
    $[...] syntax means "do the math in here", and the echo prints out the result.

    Also, you can install commandline calculators. I personally am fond of Qalculate!: there is a CLI version that you get when you install the GUI version.

  4. $spacer_open
    $spacer_close
  5. #4
    Banned jan1024188's Avatar
    Join Date
    Jul 2006
    Location
    EU, SLOVENIA
    Posts
    1,549
    anyway i dont have to make any calculations (i was just curious);

    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
  •