Sunday, October 21, 2012

Re: map ... :!/usr/bin/env python3 % in Windows?

On 21/10/12 17:17, Shay wrote:
> Thank you. I was suffring under a misconception. I was sure I'd seen
> somewhere that /usr/bin/env (my linux Python binary is in no such place) was
> some sort of magic path that could work anywhere. Unfortunately, it seems
> not.
>

/usr/bin/env is a Unix-like path to the program "env" which is invoked as

/usr/bin/env [OPTION]... [NAME=[VALUE]]... [COMMAND [ARGS]...]

where
each optional OPTION starts with one or two dashes
NAME=VALUE sets environment variable NAME to the value VALUE
NAME= (without VALUE) sets environment variable NAME to an empty value,
which, under Unix (but not under Windows) is different from unsetting it
COMMAND [ARGS]... runs the program COMMAND (found in the $PATH) with
zero or more arguments [ARGS]...
if COMMAND is not specified, env types out the resulting environment

so
/usr/bin/env python3 filename.py
means just the same as
python3 filename.py
except that if there is a shell alias (or builtin command) named python3
it won't be used.

OTOH,
/usr/bin/env PYTHONUNBUFFERED=unbuffered python3 filename.py

means running
python3 filename.py

(not as a shell alias) with the environment variable PYTHONUNBUFFERED
set to the value 'unbuffered' (without the quotes).

For details, run
info env
on a Unix-like system where env is installed.


Best regards,
Tony.
--
When in doubt, use brute force.
-- Ken Thompson

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: