I\'m trying to create a script that helps creating shebangs (Ok, it may not be that useful but has advantages when you don\'t know where the program is, for example), here\'
Probably the which
command output contains the NULL character.
The system()
function replaces line breaks with
s. (from :help system()
). Therefore you could do:
let path = substitute(system('which ' . program), '\%x00', '', 'g')
Otherwise you could do the following:
function! CreateShebang()
call inputsave()
0 put = '#!/usr/bin/env ' . input('Enter the program name: ')
call inputrestore()
endfunction