Monday, November 30, 2009

Re: Set variable to shell command output

On Monday 30 November 2009 11:38:26 am Aarto Matti wrote:

> Hi,
>
> I need to set the output from the following command to a
> variable: date +%s
> It's a string of 10 digits.
>
> I tried
> let stamp = execute "!date +\%s"
> but apparently "execute" doesn't return anything, besides I
> can't escape "%" character which is treated as buffer name.
>

just wondering: would you still want to do that if you knew vim
supports its own strftime function?

:let td = strftime("%Y-%b-%d")

will give you a nice 11 character string in 'td', and you can
adjust to your preferences

why go out for milk when there's plenty in the fridge?

sc

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment