use $SHELL for scripts without shebang

thanks to @zhaocai
Closes #613
This commit is contained in:
kongo2002 2013-04-13 12:29:57 +02:00
parent 51001b66de
commit 1ff67622c5

View File

@ -16,7 +16,7 @@ endif
let g:loaded_syntastic_sh_sh_checker=1
function! s:GetShell()
if !exists('b:shell') || b:shell == ""
if !exists('b:shell') || b:shell == ''
let b:shell = ''
let shebang = getbufline(bufnr('%'), 1)[0]
if len(shebang) > 0
@ -28,6 +28,10 @@ function! s:GetShell()
let b:shell = 'sh'
endif
endif
" try to use env variable in case no shebang could be found
if b:shell == ''
let b:shell = fnamemodify(expand('$SHELL'), ':t')
endif
endif
return b:shell
endfunction