ç·ã®bashã¦ã¼ã¶ã¼ãããã©è²ã®ç´³å£«ãã¨æ¼¢ã®zshã«ä¹ãæããã¨ã㫠アッーã£ã¦ãªãã³ãäºãå ã»ã©ããã¤ãæãã¤ããã®ã§å ±æããã !!ã¨ãã®å±¥æ´å®è¡ã¯rã³ãã³ã㧠zshã«ã¯ãr ã¨ããã·ã§ã«çµã¿è¾¼ã¿ã³ãã³ãããã£ã¦ å±¥æ´ããã®å®è¡ãç°¡åã«è¡ããã ãã¨ãã°ãä¸çªæå¾ã«å®è¡ããviã³ãã³ããå®è¡ãããã¨ããªã©ã ã bashãªããã 㨠!vi ã§åºæ¥ãã®ã ãã rã³ãã³ãã ã£ãã % r vi ã§ããã ç´åã«å®è¡ããã³ãã³ããåã³å®è¡ãããã¨ãã bashãªããã 㨠!! ã¨ããããæ¹ã«ãªããã rã³ãã³ãã§ã¯ã % r ã¨ããã ãã§ããã ã¾ããæååãç½®ãæãã¦ããã®å±¥æ´å®è¡ã¯ã©ãã ããã ãã¨ãã°æ¬¡ã®ãããªbashã®ä¾ã ã $ vi .zshrc $ !vi:s/zsh/bash/ ããã¯ãæå¾ã«å®è¡ããviã³ãã³ãã®å¼æ°æååã ":s/zsh/bash/" ã«ããzshã¨ããæ
IDEã®çºå±ãAjaxãªã©ç¾å¨ã®ãããããã«ã¨ã£ã¦GUIã¨ãã¾ããä»ãåããããã¨ã¯éçºå¹çãä¸ããããã§å¿ é ã¨ããããããããªãããã·ã§ã«ã¨ããCUIç°å¢ãæ ¹å¼·ã人æ°ããããGUIã¨éã£ãã«ã¹ã¿ãã¤ãºãã¢ã¸ãªãã£ãå¹çã®è¯ããå¹ åºã対å¿ãã©ãããã©ã¼ã ãªã©ããªãã¦ã¯ãªããªããã®ã ã æ¬é£è¼ã§ã¯ããããCUIç°å¢ã®å å®ãè£ä½ãããã¨ãç®çã¨ãã"zsh"ã«ã¤ãã¦èªã£ã¦ã¿ããã¨ãããããã¤ã¦zshã¯UTF-8ã®æ±ããå¼±ãã¨ããããã£ããããããããã¶ãã¨æ¹åããããã1å¹´ã§zshã¸ç§»è¡ããããç¶æ³ãæ´ã£ã¦ãã¦ãããã¯ãããã«ã¯æªããªãã¿ã¤ãã³ã°ã ã æåã«è»½ãzshã«ã¤ãã¦ç´¹ä»ãã¦ãããã ååã«ã¤ã"z"ã®æåã¯ãã究極ã®ãã¨ããæå³ãããããã¦ãããããã系統ã¨ãã¦ã¯shç³»ã§ãããã¤ã¾ããzshã¯shç³»ã®è¶ é«æ©è½ã·ã§ã«ã¨ãããã ãããLinuxãªã©ã®ã¦ã¼ã¶ã¼ã§ããã°shç³»ã§ãããã¨ã®æå³
zsh ã«ã¯ãzargsã³ãã³ã(çµã¿è¾¼ã¿é¢æ°) ã¨ããã®ãç¨æããã¦ããã ããã¯ãæ¡å¼µã°ããç¨ã® xargs ã³ãã³ãã¨è¨ã£ã¦ãè¯ãã ããã ããã¥ã¢ã«ãè¦ãã¨ãxargs ã³ãã³ãã¨ãªãã·ã§ã³ã¯ãå®å ¨ã«äºæãã¦ãããããã autoload zargs ã¨ããäºã§å©ç¨å¯è½ã ã 使ãæ¹ã ããxargs ã¨ããã¨ãæ¨æºå ¥åããèªã¿è¾¼ãã è¦ç´ ãè¡ã«å¯¾ã㦠ç¹å®ã®ã³ãã³ããå®è¡ããã¨ãããã®ã ã zargs ã®å ´åã¯ãå¼æ°ã«æå®ãã æ¡å¼µã°ãã ã«å¯¾ãã¦ãããã®å¦çãè¡ãã % zargs OPTIONS -- æ¡å¼µã°ãã -- å®è¡ãããã³ãã³ã ãã¨ãã°ãxargs ã§ä¸çªå©ç¨ãããã¨æããã ãã¡ã¤ã«æ°ã ARG_MAX ãè¶ãã¦ãã¾ã£ã¦ãããã£ã¬ã¯ããªå ã®ãã¡ã¤ã«ã ã¾ã¨ãã¦åé¤ãããå ´åãªã©ã¯ã次ã®ãããªã³ãã³ããå ¥åããã°è¯ãã % zargs -- ./* -- rm ããã ã
æãç°¡åãªããæ¹ãç´¹ä»ããã®ãå¿ãã¦ããã for file (*.html) mv $file $file:r.htm
zshmodules ã® zsh/files ãå©ç¨ããã¨ã chgrp, chown, ln, mkdir, mv, rm, rmdir, sync ã¨ãã£ãã³ãã³ããã zshçµã¿è¾¼ã¿ã®é¢æ°ã«ç½®æããããã ã¡ãªããã¨ãã¦ã¯ã 移æ¤æ§ãé«ããªãã å¼æ°æååã®æ大ãã¤ãæ°ã®å¶éãåããªããªã ã¨ãããã¨ãæããããã ããã ãã®ãã¡ãç¹ã«åã便å©ã ãªã¨æã£ã¦ããã®ãã å¼æ°æååã®æ大ãã¤ãæ°ã®å¶éãåããªããªãã¨ãããã¨ã ã ç°¡åã«èª¬æããã¨ã é常ãã³ãã³ããå®è¡ããã¨ãã« å¼æ°æååã®ãã¤ãæ°ãä¸å®ã®å¤ãè¶ãã㨠以ä¸ã®ããã«ã¨ã©ã¼ãåºãã¦å¦çããã¦ãããªãã % mv ./* ../dir zsh: argument list too long: mv ããã¦ææªãªäºã«ã³ã¬ã¯ã ã°ãããªã©ãå±éããå¾ã®æååã®ãã¤ãæ°ã§ããããã zsh ã® extended_glob ã¨ã¯é
zshã«ã¯ãéå»ã®å ¥åå±¥æ´ããäºæ¸¬ãã ãªã¢ã«ã¿ã¤ã ã«èªåè£å®ãã¦ãããã¨ããæ©è½ã¨ããã®ãããããã ã predict-on ã¨ããã®ã該å½ããã ä¾ãã°ä»¥ä¸ã®ç»åã¯ã ãã®æ©è½ãæå¹ã«ããç¶æ 㧠'h' ã¨ã ãå ¥åããç¶æ ã ã Enter ãã¼ãæ¼ãã ãã§ãã ã¡ã«å®è¡ã§ããã ãªãã ããçµæ§ä¾¿å©ã ã£ãã®ã§ 以ä¸ã®ãããªè¨å®ã§ä½¿ç¨ããäºã«ããã % autoload predict-on % zle -N predict-on % zle -N predict-off % bindkey '^X^Z' predict-on % bindkey '^Z' predict-off % zstyle ':predict' verbose true zsh ã® man ã§è¼ã£ã¦ãããã¼ãã¤ã³ãã«è¨å®ãã¦ã¿ãã Ctrl+X Ctrl+Z 㧠predictã¢ã¼ãã ON ã«ãªãã Ctrl+Z
zshã®ZLE Editorã使ã£ã¦ä½ããã zedã¨ããããã¹ãã¨ãã£ã¿ãã«ãã³ããããã«é常ã«ä¾¿å©ã zshã®è£å®ããã®ã¾ã¾ä½¿ãããããã % autoload zed % zed ./test.txt æä½æ¹æ³ã¯ã å¤æ´ãä¿åããã¨ãã¯ãCtrl+X Ctrl+W ã¾ã㯠Ctrl+J ã¨å ¥åã ç ´æ£ãã¦çµäºãããã¨ã㯠Ctrl+C ãå ¥åããã°ããã ãã¨ã¯ã©ã㪠bindkey ããã¦ãããã«ãã£ã¦å¤ããã®ã ã åºæ¬çã«emacsãã¼ãã¤ã³ã 使ã£ã¦ã¿ãã°ããããã©ãããæ°æè¦ãªã¨ãã£ã¿ã ãã®å ´ã§ç·¨éãã¦ãæããããããã ã½ã¼ã¹ã«ã "ä»ã®ã·ã§ã«ã«ã¯ã³ã¬ã¯åºæ¥ãªã" ã¨æ¸ãã¦ããã(ããããã ) # No other shell could do this. # Edit small files with the command line editor. ãã¨ã以ä¸ã®ãããª
zsh ã® ARITHMETIC EXPANSION ãå©ç¨ããã¨ã ç°¡åã«åºæ°å¤æããããªãäºãåºæ¥ãããã ã ãã©ã¼ãããã¯ä»¥ä¸ã®ããã«ãªã£ã¦ããã $(( [#å¤æãããåºæ°å¤] æ°å¤ )) $(( [#å¤æãããåºæ°å¤] åºæ°#æ°å¤ )) ãã¨ãã°ã10é²æ°è¡¨è¨ã® 256 ã¨ããå¤ã 2é²æ°ã8é²æ°ã16é²æ°ã«ããããåºæ°å¤æããã«ã¯ 以ä¸ã®ããã«ããã°ããã 10é²æ° -> 2é²æ° % echo $(( [#2] 256 )) 2#100000000 10é²æ° -> 8é²æ° % echo $(( [#8] 256 )) 8#400 10é²æ° -> 10é²æ° % echo $(( [#10] 256 )) 256 10é²æ° -> 16é²æ° % echo $(( [#16] 256 )) 16#100 ããã«ããã®æ°åãã©ã®åºæ°ã§è¡¨ç¾ããã¦ãããã®ã§ ããããæå®ããäºãåºæ¥ãã ã
zsh for the working researcher * Daichi Mochihashi daiti-m@is.aist-nara.ac.jp April 30, 1999 0. ã¯ããã« Unixã«ä»£è¡¨ãããã³ãã³ãå ¥ååã®æåã¯ä¸çã®ä¸ã¤ã®å´é¢ã§ãããã·ã§ã«ã¯ãã® é¡ã§ããã·ã§ã«ã«æã¡è¾¼ãæååã¯è¨èªã«ä¼¼ã¦ãä¸æ¬¡å ã®è¨å·åã§ãããªãã è±ããªã¤ã¡ã¼ã¸ãæã¡ãå¤ãã®ä»äºãè¡ããã¨ãã§ãã¾ããç§ã¯Macintoshã 大好ãã§ãããGUIã ãã§ãªããã®ãããªæååã«ããã·ã¹ãã ã®æä½ã«ã ãã種ã®ç¾ãæããã¾ã便å©ã§ãããã¨æã£ã¦ãã¾ãã ãããã£ã¦ãã·ã¹ãã ã¨ã®ã³ãã¥ãã±ã¼ã·ã§ã³ãè±ãã«ããããã«ã¯ããã®é¡ã§ãã ã·ã§ã«ã§è¡¨ç¾ã§ãããã¨ãå¢ãããªããã°ãªãã¾ãããå¤ãã®äººã¯, (t)csh, ããã㯠bash ã使ã£ã¦ããã¨æãã¾ããããã®ããã¥ã¡ã³ãã§ã¯ãããã®ä¸ä½äºæã®
è¤æ°ã®ãã¡ã¤ã«ã®ååãå¤æ´ããéã«ã 便å©ãªã³ãã³ãã¨ãããã®ãããã ããã¤ããç´¹ä»ããã¦ããã ããã ã«ã¬ã³ããã£ã¬ã¯ããªã«ãããã¡ã¤ã«ã®ååãã ãã¨ãã°ã*.html ã *.htm ã¨ååãå¤æ´ããã¨ãã課é¡ã«å¯¾ã ã©ã®ãããã¨ã¬ã¬ã³ãã«æ¸ãããã¨ããã®ãæ¯è¼ãã¦ã¿ãã ã¾ããæ®éã«ãã£ããã©ãã ããã ãããããforæ ãã¤ãããã¨ã ããã for file in *.html do base=`basename $file .html` mv $base.html $base.htm; done; zshã ã¨ããã¡ãã£ã¨ã¹ãã¼ãã«ããã¦ã for file in *.html do mv $file:r.html $file:r.html; done; ãããªå ·åã foræ ãå«ããªãããå³ç¿¼ã®ããã«ã xargs ã使ã£ã¦ãã®åé¡ã解ãã¦ã¿ããã ls -1 *.htm
zsh ã®ã¢ã¸ã¥ã¼ã«ã« zpty ã¨ããã®ãããã®ãæè¿çºè¦ããã ã©ããã³ã¬ãå©ç¨ããã°æå®ããã³ãã³ãã ä»®æ³ç«¯æ«ä¸ã§å®è¡ãããã¨ãåºæ¥ããããã å ·ä½çã«ã©ããã£ããã¨ãåºæ¥ãããã«ãªãã®ãã¨ããã¨ã 端æ«ãå¿ è¦ãªããã°ã©ã ãèªååãããã¨ãåºæ¥ãã ãã¨ãã°ããã¹ã¯ã¼ãå ¥åå¦çãªã©ã ã ãã¹ã¯ã¼ãæååãæ¨æºå ¥åããèªã¿è¾¼ã¾ãããã¨ãã¦ãã 大æµã®ããã°ã©ã ã§ã¯å ¥åã§ããªãã ãªããã¨ããã¨ãå¤ãã®ããã°ã©ã ã«ããã¦ãã¹ã¯ã¼ãå ¥åå¦ç㯠端æ«ããèªã¿è¾¼ãããã«ä½ããã¦ããããã ã zpty ãå©ç¨ããã°ãããã£ããããã®ãã®ããã¹ã¦èªååã§ããã ãããããexpect ã¨ããã³ãã³ãã§å®ç¾ãã¦ãããã¨ã zsh ã ãã§åºæ¥ãã®ã ã ä»åã¯ãç°¡åã«è©¦ããã¨ãåºæ¥ããµã³ãã«ã¨ãã¦ã su ã³ãã³ãã®ãã¹ã¯ã¼ãå ¥åã zpty ã使ã£ã¦èªååãã¦ã¿ãã ã¾ããzsh ã«æ¨æºæ·»ä»ããã¦ã
wiki ã«ãã¦ããã¨æ¥è ãã¦ã¶ãã®ã§ç HTML ã§è¡ããã¨ã«ãã¾ããã ã ããã¨ãã£ã¦æ´æ°ããããã«ãªãããã§ããªãã¨ã¯æãã¾ããã (岸ç°) ãUNIXä»æ¥ã®æãã¯ããUNIX åå¿è ãä¸ç´è ã«ã¬ãã«ã¢ããããããã®è¶³æãããã¨ãªãäºãç®çã¨ãã¦ãã¾ãã ã§ãã®ã§ããls ã£ã¦ä½ï¼ãã¨ãããããªã¬ãã«ã®äººã¯ã¾ãæ¬ãªã©ã§(åºæ¬çãªã³ãã³ãç¨åº¦ã§è¯ãã®ã§)åå¼·ãã¦ããã«ããæ¹ãè¯ãã¨æãã¾ãã ãã¨ãå½ç 究室ç¹æã®äºæ ãç 究ã§ãããªãããä½æ¥(VASP ã使ããªã©)ããã®ã¾ã¾ä¾ã«æãããã¨ãããããã¾ãã (ä»ã¾ãã«è¡¨ç¤ºããã¦ãã)ãã®ãã¼ã¸ã«æ¸ããã¦ããã®ã¯ææ°ã®è¨äºã§ãããæ¸ãã¦ããæ«ãæéã®çµã£ãç©ã¯é©å½ãªã¿ã¤ãã³ã°ã§ archives ã«æ¾ãè¾¼ãã§ãã¾ãã vim: é£ç¶ä¸æ¸ãã¢ã¼ã ãã¨ãã°ã以ä¸ã®ãã¡ã¤ã«ãããã¨ãã¾ãã (ã¡ãªã¿ã«ãã㯠VASP ã® POSCARã®ä¸é¨åã§
function cd() { builtin cd $@ && ls --color=auto; }
ããã便å©ãªã®ãè¦ã¤ãã¦ãã¾ã£ãã ããã¯ããã ESC + " ã¨å ¥åããäºã§ã ã«ã¼ã½ã«ä½ç½®ã¾ã§ãã¨ã¹ã±ã¼ãããäºãåºæ¥ãã¿ããã ã ãã¨ãã°ã以ä¸ã®ããã«æååãå ¥åããç¶æ ã§ã $ hello world hello ã® o ã®æ¬¡ã®ä½ç½®ã§ ESC + " ã¨å ¥åãã㨠$ 'hello' world ã¨ã·ã³ã°ã«ã¯ã©ã¼ãã§å²ã£ã¦ãããã è¤æ°åå ¥åããäºã§ã $ ''\''hello'\''' world ã©ãã©ãã¨ã¹ã±ã¼ããã¦ããã ESC + $ ã§ãã®éãè¡ãã $ 'test test' $ test test
[shell] ls ããã¡ã¾ãã人㸠- Bulknews::Subtech - subtech èªåã¯ããã¾ã ls æããªããã¨ããã®ã .tcshrc 㧠alias cwdcmd 'll' ã¨ãã¦ãã¦ããããã㨠cd ãããã³ã« ll ãåæã«å®è¡ããããããå¿ è¦ãªããzsh ã§ã©ãããã®ãã¯ãããªããã©ããã¶ãã§ããã§ãããã èªåã§ã¯zshãã¤ãã£ã¦ãããã以ä¸ã®è¨å®ããã¦ããã function cd() { builtin cd $@ && ls; }cd ãããã¨ã«lsãå®è¡ãããã è¿½è¨ ãã£ã¨ãä¸ã®ãã¤ã¯ã³ã¡ã³ãã¢ã¦ããã¦ãã»ã» function chpwd() { ls }ã©ã£ã¡ã§ããããã©ã 追è¨2 id:naoyaããã®ã³ã¡ã³ããã chpwd ãªã setopt auto_cd ã§ã ok ã½ ã¨ã®ãã¨ã ããããã(auto_cdã¤ãã£ã¦ãªããã»ã»ã»)ã
Esc + ããã(.) ã¨å ¥åããã¨ã ç´åã«å ¥åããã³ãã³ãã®æå¾ã®å¼æ°ãè£å®ãã¦ãããã è¤æ°åå ¥åããäºã«ãã£ã¦ã éå»ã«ã©ãã©ãããã®ã¼ã£ã¦ããã 追è¨: ããã¯ãã¼ã¯ã³ã¡ã³ãã«ãæ¸ããã¦ã¾ããã Esc ã¯ãæ£ç¢ºã«ã¯ Meta ãã¼ã§ãã ããã«è¿½è¨: ä»ã«ããè²ã ããããã§ã id:hiboma ããã®ä»¥ä¸ã®ãã¼ã¸ã«é常ã«è©³ããæ¸ããã¦ãã¾ãã http://d.hatena.ne.jp/hiboma/20061005/1160015116
zshã§ãããã試ãã¦ããå°æãè¦ã¤ããã®ã§ã¡ã¢ãã¾ããZãªäººããããã°ããããªã®å¸¸èã ãï¼ãã¨ãããã®ãããããªããã©ãï¼ã¡ãªã¿ã«man zshzleã«å ¨é¨è¼ã£ã¦ãããã ãè±èªã§ããï¼ ï¼è¨å®ã«ãã£ã¦ã¯ãã¾ãåããªããã®ããããããããªãã®ã§ãäºæ¿ã M + h => ãããã¡å ã®æåã®åèªã«å¯¾ã㦠run-help ãã é¢æ°å:run-help man hoge ã¨éãã®ã¯ãã³ãã³ãããããã¡ã«æ®ã£ãã¾ã¾ã«ãªãç¹ãå度ã³ãã³ãå ¥åãããªãã¦ãããã M + Â¥(ããã¯ã¹ã©ãã·ã¥) => ãããã¡å ã®æåã®åèªã«å¯¾ã㦠which-commandãã é¢æ°å:which-command which-command 㯠which ã¨ã»ã¼åããM + ? ã§ãåãã ã M + / => ãã¹ããªã¼ã¯ã¼ãã®å±é é¢æ°å: history-complete-older åèªã¬ãã«ã§ã®å±¥æ´ãå±
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}