On Jan 23, 2008 11:15 AM, Erik Falor wrote: > > On 23/01/2008, Dasn wrote: > > I don't think "#!/usr/bin/env vim -S" is workable on all platforms. > > > > $ cat test.vim > > #!/usr/bin/env vim -S > > echo "this is a Vim script" > > quit > > $ chmod +x test.vim > > $ ./test.vim > > env: vim -S: No such file or directory > > > > Which platform are you on? > > On SunOS 5.9, using coreutils 5.94, I don't get your error message. However > on Linux using coreutils 5.93, I do. > > If I run `/usr/bin/env vim -S` from the command-line on either platform, I > don't get "No such file or directory". > Only from within a script on my Linux platform do I get that. Even though > the man page says I can supply arguments to the command. > > I'm leaning towards saying this is a bug in env.
Nope, it's because the #! mechanism is horribly, horribly unstandardized (and not actually specified by POSIX or SUSV3, so far as I know). See the notes at http://www.in-ulm.de/~mascheck/various/shebang/ , in particular the "Test results from various systems" section, where the author notes that some systems put each argument in its own argv, and others only pass the first argument. So, "#!/usr/bin/env vim -S test.vim" could be equivalent to any of the following commands in a shell: /usr/bin/env "vim -S" test.vim /usr/bin/env vim -S test.vim As well as some other particularly abhorrent ones like /usr/bin/env vim test.vim /tmp/test.vim -S test.vim Such is the world of portable shell scriping. Given the fact that you can't reliably expect to give more than one argument, I think that the example should use "/usr/bin/vim -S" rather than "/usr/bin/env vim -S". ~Matt --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---