
다음을 실행하여 최신 Vim 패치를 결정하는 쉘 스크립트(구체적인 내용이 필요한 경우 Zsh에서 실행됨)를 작성하려고 합니다.
git pull origin master
vernew=$(git describe --tags | sed 's/^v//;s/-/./g')
Vim의 git 저장소 로컬 복사본을 사용하여 현재 설치한 Vim 버전과 비교하고 두 버전이 다른 경우 OBS(Open Build Service)에 있는 사양 파일에 정의된 패치 수준을 수정합니다.Vim 저장소. 이를 수행하려면 현재 설치된 Vim 버전과 동일한 변수를 정의하는 방법을 알아야 합니다. 다음과 같이 정의합니다.
verold=$(vim --version)
vim --version
적어도 나를 위해 실행되는 옵션이 아닙니다 .
VIM - Vi IMproved 7.4 (2013 Aug 10)
Included patches: 1-1304
Compiled by 'http://www.opensuse.org/'
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt -tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel +gettext -mzscheme +title
+cindent -hangul_input +netbeans_intg -toolbar
+clientserver +iconv +path_extra +user_commands
+clipboard +insert_expand +perl/dyn +vertsplit
+cmdline_compl +job +persistent_undo +virtualedit
+cmdline_hist +jumplist +postscript +visual
+cmdline_info +keymap +printer +visualextra
+comments +langmap +profile +viminfo
+conceal +libcall +python/dyn +vreplace
+cryptv +linebreak +python3/dyn +wildignore
+cscope +lispindent +quickfix +wildmenu
+cursorbind +listcmds +reltime +windows
+cursorshape +localmap +rightleft +writebackup
+dialog_con +lua/dyn +ruby/dyn +X11
+diff +menu +scrollbind +xfontset
+digraphs +mksession +signs -xim
-dnd +modify_fname +smartindent +xsmp_interact
-ebcdic +mouse +sniff +xterm_clipboard
+emacs_tags -mouseshape +startuptime -xterm_save
+eval +mouse_dec +statusline -xpm
+ex_extra -mouse_gpm -sun_workshop
+extra_search -mouse_jsbterm +syntax
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/etc"
f-b for $VIMRUNTIME: "/usr/share/vim/current"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=1 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wall -pipe -fno-strict-aliasing
Linking: gcc -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.22.0/x86_64-linux-thread-multi/CORE -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXt -lX11 -lSM -lICE -lm -lnsl -ltinfo -lacl -lattr -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.22.0/x86_64-linux-thread-multi/CORE -L/usr/local/lib64 -fstack-protector-strong -L/usr/lib/perl5/5.22.0/x86_64-linux-thread-multi/CORE -lperl -lm -ldl -lcrypt -lpthread
이 출력의 두 번째 줄에는 내가 관심 있는 패치 수준이 포함되어 있습니다. 하지만 verold
단순히 패치 수준과 동일하다고 정의하는 방법을 모르겠습니다 . verold
이 값을 제공하는 방법을 알고 있다면 정식 버전(예: 7.4.1304)도 허용되는 값입니다 .
답변1
verold=$(vim --version |sed -n 's/^Included patches:\s1-*//p')