Hexan, I've just managed to put the scripts to work... it was "only" a problem with DOS line-endings (CRLF). Running the dos2unix command resolved the issue.
By the way, I'm using an old net laptop with chromixium OS.
Thanks, your scripts are great!!!