How can i find out whether i am on Windows or not?
I need to execute an OS specific command in AWK.
Specifically, i want to
system("mkdir DIR") on windows and
system("mkdir -p DIR") everywhere else (Unix/Linux/OS X/BSD),
to create a directory recursively.
I can’t test this answer because I don’t have access to a
Windowssystem, but give a try to theENVIRONvariable. Linux and Unix paths are separated with:whileWindowspaths are separated with;. You could check it, something like:This could fail if there is only one directory in the
Windowspath, but I hope you get the idea. Perhaps a combination of several environment variables or something similar could be more helpful.