Conversation
|
@TjlHope had a nice fallback that only relies on bash, so could replace the rest of the script if |
|
Nobody from the project has reviewed this, so I'm not going to change things until I get a sense of what they expect here. If they prefer the bash-only option from #3792, then I'm happy to switch to that |
|
So it is still not reduced :-) |
| #!/bin/bash | ||
|
|
||
| if [ -x "$(command -v sleep)" ]; then | ||
| sleep $1 |
There was a problem hiding this comment.
BTW, it's also recommended to add -- between the cmd and the arg. But since the POSIX version doesn't accept any options, the -- could make it crash on some systems
| ping -c $(( $1 + 1 )) 127.0.0.1 > /dev/null | ||
| exit 0 | ||
| fi | ||
|
|
||
| SECONDS=0 | ||
| while [[ $SECONDS != $1 ]]; do | ||
| while [[ $SECONDS -lt $1 ]]; do |
There was a problem hiding this comment.
+ and -lt are vulnerable to code-injection (SC)
Previously mentioned here
|
What speaks against If something like that worked, you wouldn't need to rely on sleep at all, and it's been in bash since version 2.04-devel or sth (i.e., forever). |

Addresses #2380