From: Dossy Date: 2002-05-29T20:20:02+09:00 Subject: Re: OS independent scripts, system calls on Windows and Linux On 2002.05.29, Tobias Reif wrote: > > 3. "date" comes standard with all Linux distributions. It doesn't > > come standard with Windows, This may be the root cause of some of > > the error messages shown above. > > > ??? That's why I wrote > > > C:\>date > > Aktuelles Datum: Fr, 24.05.2002 > > Neues Datum (TT.MM.JJ): > > It is available here. > Did you read my examples? > > See: > > C:\WINDOWS>ruby -e "puts `ver`" > -e:1: command not found: ver > C:\WINDOWS>ruby -e "puts system('ver')" > false > C:\WINDOWS>ver > Windows Millennium [Version 4.90.3000] Unlike Unix, where "date" is a real command that can be executed by another program, in DOS the "date" command is a shell builtin, part of COMMAND.COM (or CMD.EXE, or whatever DOS shell you're running). So, this isn't a bug in Ruby at all, it's a misunderstanding of yours how things are supposed to work. Try this: C:\WINDOWS\COMMAND>ver Windows 98 [Version 4.10.2222] C:\WINDOWS\COMMAND>ruby -e 'puts `mem`' Memory Type Total Used Free ---------------- -------- -------- -------- Conventional 640K 93K 548K Upper 0K 0K 0K Reserved 384K 384K 0K Extended (XMS) 15,360K ? 200,112K ---------------- -------- -------- -------- Total memory 16,384K ? 200,660K Total under 1 MB 640K 93K 548K Largest executable program size 547K (560,624 bytes) Largest free upper memory block 0K (0 bytes) MS-DOS is resident in the high memory area. C:\WINDOWS\COMMAND>ruby -e 'puts system("mem")' Memory Type Total Used Free ---------------- -------- -------- -------- Conventional 640K 91K 549K Upper 0K 0K 0K Reserved 384K 384K 0K Extended (XMS) 15,360K ? 200,116K ---------------- -------- -------- -------- Total memory 16,384K ? 200,665K Total under 1 MB 640K 91K 549K Largest executable program size 549K (562,192 bytes) Largest free upper memory block 0K (0 bytes) MS-DOS is resident in the high memory area. true C:\WINDOWS\COMMAND>dir mem.exe Volume in drive C is IDE 0 Volume Serial Number is 1407-3D60 Directory of C:\WINDOWS\COMMAND MEM EXE 32,146 04-23-99 10:22p MEM.EXE 1 file(s) 32,146 bytes 0 dir(s) 536.95 MB free See, backticks (`) and #system both simply search the PATH environment variable for an executable that you've named. If it doesn't find it (like in the case of "date" or "ver" which are both shell builtins and not standalone executables) ... well ... it won't find it, and not be able to execute it. -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)