I have been doing it for quite some time. There isn't any issue. The only way you can get caught is if you have opted for PF in both the companies.
Don't opt for PF in one company. Companies can check your entry and exit date through PF. All of us have option to opt in or opt out of PF.
CEOs can work for multiple companies but we can't, why?
Most companies won't even take any action if they know you are working with multiple companies cause even they have trained and invested in you but the condition is never fail to ship/deliver.
And never working with companies in same industry or domain or competitors. It's a conflict of interest.