I am trying to find the difference between two dates & need to assign that value in a variable for further code. I am able to find the difference but have some issues with it.
Value is coming in decimal point ( 82.95833333333333333333 ) which should be actually 83 days
I am able to print the difference with echo command but when I assign it to some variable it fails.
Can someone please take a look at it & help to sort out ? below is the code I am using now :
I generally recommend $(...) instead of `...` for command substitution since different single quotes can be easily mixed up and easy nesting is only possible with the braces.
Note especially the printf command within awk. It accomplishes the rounding.
To get it into a variable you have to use another command substitution: