glob and backslashes on windows
Closed / Invalid611125ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-09-18 14:40:07
glob and open work differently when it comes to backslashes on Windows. Both work fine with /. Eg: % glob S:/foo/bar S:/foo/bar % open S:/foo/bar filexxx With backslashes, glob works for the drive letter: % glob S:\\foo/bar S:\foo/bar But with double backslash it fails, yet open does not: % glob S:\\foo\\bar no files matched ... % open S:\\foo\\bar fileyyy
vincentdarleyplain2002-09-19 00:24:03
Logged In: YES user_id=32170 Remember that 'glob foo' is treating 'foo' as a pattern, and therefore if 'foo' contains "glob-sensitive" characters (the curly braces and backslash, for example), then those characters must be quoted if you don't want glob to treat foo as a pattern. If you don't want 'foo' treated as a pattern, then use '- path', for example: glob -path S:\\foo\\bar "" in your example above will work. What is happening is that 'glob' is actually looking for the file S:foo/bar in your second example (which we interpret as S:/foo/bar and is found), but in the 3rd example it is looking for S:foobar (= S:/foobar) which doesn't exist. 'open' obviously doesn't treat its argument as a pattern, so is quite happy either way.
Log in (anonymous is fine) to add a comment.