remind me when I should publish the solution :)
Feedback: "You do not emphasize that the function is used by people having it sourced without knowing the code, but only knowing the description."
Yes, it is meant like that: you write a shell script and you included that function. Depending on the use of the function you'll encounter pitfalls - at least two of them.
The obvious one having been mentioned already.
@me The dd
output is limited by count=1111
and may therefore contain less than $bytes
characters among those specified by $chars
. In which case the sed
output will be empty. Anything else?
A #riddle. There are two pitfalls in this code. One cloaking the other. Can you see them?