This is AFAIK not dependent on the OS but how you run Mathematica. If you only run the Kernel in batch mode, it is $Input
which you can ask to get a file path of the script just running. It sometimes needs some extra care as it will not always hold the full file name if I remember correctly. I'd start to just print its content in your script and then add/change what's necessary.
As rm-rf has noted there is now (introduced in version 8) $InputFileName
which seems to not be affected by the potential problems I mentioned.