Re: Is there a POSIX compliant way of turning a "HH:MM:SS" formatted string to seconds? ...
On Friday, July 18, 2025 12:52:03 AM CEST, Greg Wooledge wrote:
As far as the code goes, I'd rather start from scratch.
just out of curiosity:
i don't like fix global return values (like $r in your code). i'd rather
give the function a variable name to put the result in.
do you have any objections to doing this in bash?:
========================================================================
#!/bin/bash
# $1: name of variable to put the result in
# $2...#n: parameters optional for whatever the function does
myfunc ()
{
# do something... or not...
printf -v "$1" "%s..." "..." ...
}
myfunc "my_result" ...
echo "$my_result"
========================================================================
an yes, i don't care about POSIX compliance.
greetings...
Reply to: