Quote:
Originally Posted by dalacor
Can't see what bug you mean.
|
Which is all the more reason to use existing well-tested tools as much as possible - the less code one needs to write to achieve a task, the lower the chance of bugs creeping in.
If you run
ShellCheck against the script it will highlight "
Double quote to prevent globbing and word splitting." - whilst this is only listed as "info" (because ShellCheck doesn't know what variables contain) any time a variable contains a filename, it is a bug in the script, because certain filenames will cause errors.
Another example - if your grep still looks what Pan quoted in post #14 then there's probably a bug there, because it's not doing a whole line match. That's also easily fixable, but if you can instead replace the whole while/grep section with something based on either of the commands in post #7 then that's even less code...