Modelines are only for options.
If you want this mapping only for that file, add this snippet to your ~/.vimrc
:
augroup ThisFile
autocmd!
autocmd BufRead,BufNew /path/to/file nnoremap <buffer> <leader>t :w\|:!./script.sh <cr>:
augroup END
edit
It looks like you want a mapping for executing the current file. If so, you are really chasing the wrong rabbit, here, and also crashing real hard in the XY Problem wall.
You can use %
as a synonym for "the file associated with the current buffer" so, assuming your script is executable, this command would execute it:
:w|!./%<CR>
Therefore, you could simply put this generic mapping in your ~/.vimrc
:
nnoremap <leader>t :w\|!./%<CR>
Note 1: See :help c_%
for the meaning of %
and in that context.
Note 2: The bar needs to be escaped when used in a mapping, see :help map_bar
.