{"id":1853,"date":"2014-08-04T00:55:23","date_gmt":"2014-08-03T15:55:23","guid":{"rendered":"http:\/\/daily.belltail.jp\/?p=1853"},"modified":"2014-09-01T09:22:22","modified_gmt":"2014-09-01T00:22:22","slug":"zsh%e3%81%a7%e3%83%91%e3%82%b9%e7%b3%bb%e7%92%b0%e5%a2%83%e5%a4%89%e6%95%b0%e3%81%ae%e9%87%8d%e8%a4%87%e3%82%92%e9%99%a4%e5%8e%bb%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/daily.belltail.jp\/?p=1853","title":{"rendered":"zsh\uff08\u3084sh\u3084bash\uff09\u3067\u30d1\u30b9\u7cfb\u74b0\u5883\u5909\u6570\u306e\u91cd\u8907\u3092\u9664\u53bb\u3059\u308b"},"content":{"rendered":"<p>\u9b5a\u3078\u3093\u306e\u3064\u304f\u6f22\u5b57\u306f\u975e\u5e38\u306b\u305f\u304f\u3055\u3093\u3042\u3063\u3066\u3001\u3088\u304f\u96d1\u5b66\u554f\u984c\u3068\u304b\u306b\u306a\u308b\u3093\u3067\u3059\u304c\u3001\u5b9f\u969b\u306e\u3068\u3053\u308d\u3044\u304f\u3064\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u3002Unicode\u306e\u6587\u5b57\u8868\u3067\u8abf\u3079\u3066\u307f\u305f\u3068\u3053\u308d\u3001<span style=\"color:red;\"><strong>\u9b5a\u3078\u3093\u306e\u3064\u304f\u6f22\u5b57\u306f394\u7a2e\u985e<\/strong><\/span>\u3042\u308a\u307e\u3057\u305f\u3002\u5b9f\u969b\u306f\u3082\u3063\u3068\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u304c\u3001\u3059\u3054\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u3055\u3066\u3001tmux\u3092\u4f7f\u3063\u3066\u3044\u305f\u308a\u3001\u30b7\u30a7\u30eb\u8a2d\u5b9a\u3092\u66f8\u304d\u63db\u3048\u3066source\u3057\u305f\u308a\u306a\u3069\u3001PATH\u3084LD_LIBRARY_PATH\u306a\u3069\u306e\u30d1\u30b9\u7cfb\u74b0\u5883\u5909\u6570\u306e\u8a18\u8ff0\u304c\u91cd\u8907\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3088\u304f\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306e\u30e1\u30e2\u3002<br \/>\n\u53c2\u8003\u306f\u3053\u3061\u3089\u3002\u3068\u3044\u3046\u304b\u5b8c\u5168\u306b\u305d\u306e\u307e\u307e\u3002<br \/>\n[http:\/\/d.hatena.ne.jp\/yascentur\/20111111\/1321015289:title=zsh \u3067\u74b0\u5883\u5909\u6570 LD_LIBRARY_PATH\u3001INCLUDE \u306a\u3069\u306e\u91cd\u8907\u30d1\u30b9\u3092\u9664\u53bb\u3059\u308b &#8211; \u30ad\u30fc\u30dc\u30fc\u30c9\u3092\u305f\u305f\u304f\u3068\u304d]<\/p>\n<p>zshrc\u3084zshenv\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306a\u8a18\u8ff0\u3092\u3059\u308c\u3070OK\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntypeset -T LD_LIBRARY_PATH ld_library_path; typeset -U ld_library_path\r\ntypeset -T LIBRARY_PATH library_path; typeset -U library_path\r\ntypeset -T CPATH cpath; typeset -U cpath\r\n<\/pre>\n<p>\u3069\u3046\u3044\u3046\u610f\u5473\u304b\u306f\u53c2\u8003\u30b5\u30a4\u30c8\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u7279\u306bPATH\u306a\u3069\u306b\u95a2\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u8a18\u8ff0\u3067\u91cd\u8907\u9664\u53bb\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntypeset -U path cdpath fpath manpath\r\n<\/pre>\n<p>\u3068\u3053\u308d\u3067\u3001\u30d1\u30b9\u8a18\u8ff0\u306e\u91cd\u8907\u3063\u3066\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u306f\u5f71\u97ff\u3059\u308b\u306e\u304b\u306a\u3002<br \/>\n\u3064\u307e\u308a\u3001\u5b9f\u969b\u306e\u30d1\u30b9\u63a2\u7d22\u306e\u6bb5\u968e\u3067\u3001\u3059\u3067\u306b\u898b\u305f\u3068\u3053\u308d\u3092\u307e\u305f\u898b\u306b\u884c\u3063\u305f\u308a\u3059\u308b\u3093\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u3060\u3068\u3059\u308b\u3068\u91cd\u8907\u9664\u53bb\u306f\u7d76\u5bfe\u5fc5\u8981\u3067\u3059\u306d\u30fc\u3002<\/p>\n<p>\u3042\u3068\u3001bash\u3067\u540c\u3058\u3053\u3068\u3092\u3057\u305f\u3044\u5834\u5408\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3093\u3067\u3057\u3087\u3046\u3002<br \/>\n\u3053\u3093\u306a\u304b\u3093\u3058\u3067\u91cd\u8907\u9664\u53bb\u81ea\u4f53\u306f\u3067\u304d\u306a\u304f\u306f\u306a\u3044\u3067\u3059\u304c\u3001<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ PATH=c:b:c:a:b:a\r\n$ PATH=`echo $PATH | sed &quot;s\/:\/\\n\/g&quot; | sort -u | paste -sd &quot;:&quot;`\r\n$ echo $PATH\r\na:b:c\r\n<\/pre>\n<p>\u8a18\u8ff0\u9806\u304c\u5909\u5316\u3057\u3066\u3057\u307e\u3044\u3001\u5b9f\u969b\u306e\u30d1\u30b9\u63a2\u7d22\u306e\u9806\u5e8f\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3044\u3001\u30a4\u30b1\u3066\u306a\u3044\u304b\u3093\u3058\u3067\u3059\u3002<br \/>\n\u529b\u6280\u3067\u3067\u304d\u306a\u3044\u3053\u3068\u306f\u306a\u3044\u3051\u3069\u30fb\u30fb\u30fb\u30b9\u30de\u30fc\u30c8\u306b\u3067\u304d\u306a\u3044\u3082\u306e\u304b\u3002<\/p>\n<p><span style=\"color:pink\">\u8ffd\u8a18\u3002bash\u3084sh\u3067\u306e\u91cd\u8907\u9664\u53bb\u3092\u529b\u3065\u304f\u3067\u3084\u3063\u3066\u307f\u305f\u306e\u3067\u3001\u8208\u5473\u304c\u3042\u308c\u3070\u7d9a\u304d\u3092\u53c2\u7167\u3002<\/span><\/p>\n<p><!--more--><\/p>\n<p>\u529b\u3065\u304f\u3067\u91cd\u8907\u9664\u53bb\u3084\u308b\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u66f8\u3044\u3066\u307f\u305f\u3002<br \/>\nbash\u306e\u5834\u5408\u3002\u30cf\u30a4\u30e9\u30a4\u30c8\u90e8\u5206\u306fzsh\u3084sh\u7248\u3068\u306e\u9055\u3044\u306e\u3042\u308b\u90e8\u5206\u3002<\/p>\n<pre class=\"brush: bash; highlight: [3,4,6]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\nTMP=(`echo $PATH | sed &quot;s\/:\/ \/g&quot;`)\r\nRESULT=${TMP&#x5B;0]}\r\n\r\nfor P in ${TMP&#x5B;@]}; do\r\n    if test $(echo $RESULT | grep -c $P) -eq 0; then\r\n        RESULT=$RESULT:$P\r\n    fi\r\ndone\r\nexport PATH=$RESULT\r\n<\/pre>\n<p>\u3046\u3054\u304b\u3059\u3068\u3001\u5b9f\u969b\u306e\u30d1\u30b9\u63a2\u7d22\u9806\u3092\u4fdd\u3063\u3066\u91cd\u8907\u9664\u53bb\u3067\u304d\u3066\u3044\u3066\u3001\u30a4\u30b1\u3066\u308b\u611f\u3058\u3067\u3059\u3002<br \/>\n\u305f\u3060\u3057\u898b\u3066\u306e\u901a\u308a\u3001\u4f8b\u3048\u3070PATH\u304c\u7a7a\u306e\u5834\u5408\u306a\u3069\u306e\u4f8b\u5916\u30d1\u30bf\u30fc\u30f3\u306e\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306f\u307b\u3068\u3093\u3069\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ PATH=c:a:b:c:b:a\r\n$ .\/uniqpath.sh\r\n$ echo $PATH\r\nc:a:b\r\n<\/pre>\n<p>sh\u306e\u5834\u5408\u3002<\/p>\n<pre class=\"brush: bash; highlight: [3,4,5,7]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/sh\r\n\r\nTMP=`echo $PATH | sed &quot;s\/:\/ \/g&quot;`\r\nRESULT=`echo $TMP | sed &quot;s\/\\s.\\+\\$\/\/g&quot;`\r\n#RESULT=`echo $TMP | sed &quot;s\/ \/\\n\/g&quot; | head -n 1`  #\u3053\u308c\u3067\u3082\u53ef\r\n\r\nfor P in $TMP; do\r\n    if test $(echo $RESULT | grep -c $P) -eq 0; then\r\n        RESULT=$RESULT:$P\r\n    fi\r\ndone\r\nexport PATH=$RESULT\r\n<\/pre>\n<p>\u7279\u306b\u610f\u5473\u306f\u306a\u3044\u3051\u3069zsh\u7248\u3002\u307b\u3068\u3093\u3069bash\u7248\u3068\u540c\u3058\u3060\u3051\u3069\u3001\u914d\u5217\u306e\u6271\u3044\u304c\u5fae\u5999\u306b\u9055\u3046\u305f\u3081\u30fb\u30fb\u30fb<\/p>\n<pre class=\"brush: bash; highlight: [3,4,6]; title: ; notranslate\" title=\"\">\r\n#!\/bin\/zsh\r\n\r\nTMP=(`echo $PATH | sed &quot;s\/:\/ \/g&quot;`)\r\nRESULT=$TMP&#x5B;1]\r\n\r\nfor P in ${TMP&#x5B;@]}; do\r\n    if test $(echo $RESULT | grep -c $P) -eq 0; then\r\n        RESULT=$RESULT:$P\r\n    fi\r\ndone\r\nexport PATH=$RESULT\r\n<\/pre>\n<p>\u30b7\u30a7\u30eb\u306e\u9055\u3044\u306b\u3088\u308b\u3073\u3063\u307f\u3087\u30fc\u306a\u6319\u52d5\u306e\u9055\u3044\u3001\u3057\u3093\u3069\u3044\u3002\u3002<br \/>\nRESULT\u306e\u521d\u671f\u5024\u306f\u3001\u6700\u7d42\u7684\u306aPATH\u306e\u5148\u982d\u3084\u672b\u5c3e\u306b\u30b3\u30ed\u30f3\u304c\u3064\u304f\u306e\u304c\u30a4\u30b1\u3066\u306a\u3044\u306e\u3067\u3001\u756a\u4eba\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u3066\u308b\u308f\u3051\u3067\u3059\u3002\u305d\u3053\u6c17\u306b\u3057\u306a\u3044\u306a\u3089\u3082\u3063\u3068\u3059\u3063\u304d\u308a\u3044\u304d\u305d\u3046\u3002<\/p>\n<p>\u304a\u3055\u304b\u306a\u3092\u81ea\u79f0\u3057\u306a\u304c\u3089fish\u3067\u8a66\u3055\u306a\u3044\u70b9\u304c\u30aa\u30c1\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9b5a\u3078\u3093\u306e\u3064\u304f\u6f22\u5b57\u306f\u975e\u5e38\u306b\u305f\u304f\u3055\u3093\u3042\u3063\u3066\u3001\u3088\u304f\u96d1\u5b66\u554f\u984c\u3068\u304b\u306b\u306a\u308b\u3093\u3067\u3059\u304c\u3001\u5b9f\u969b\u306e\u3068\u3053\u308d\u3044\u304f\u3064\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u3002Unicode\u306e\u6587\u5b57\u8868\u3067\u8abf\u3079\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u9b5a\u3078\u3093\u306e\u3064\u304f\u6f22\u5b57\u306f394\u7a2e\u985e\u3042\u308a\u307e\u3057\u305f\u3002\u5b9f\u969b\u306f\u3082\u3063\u3068\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u304c\u3001\u3059 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,38,10],"class_list":["post-1853","post","type-post","status-publish","format-standard","hentry","category-1","tag-linux","tag-38","tag-10"],"_links":{"self":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts\/1853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1853"}],"version-history":[{"count":0,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=\/wp\/v2\/posts\/1853\/revisions"}],"wp:attachment":[{"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daily.belltail.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}