LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get absolute value of integer? abs command does not work, man pages exist
#2
Just remove the minus sign if it's there, like this:

num=-4
num=$(echo $num |sed 's/\-//g')

echo $num
4
Reply


Messages In This Thread
Re: How to get absolute value of integer? abs command does not work, man pages exist - by kpanic - 07-28-2018, 04:06 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)