{"id":9337,"date":"2023-02-10T06:22:29","date_gmt":"2023-02-09T21:22:29","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=9337"},"modified":"2023-02-10T06:33:44","modified_gmt":"2023-02-09T21:33:44","slug":"linux%e3%81%aebash%e3%81%ae%e5%85%a8%e3%83%a6%e3%83%bc%e3%82%b6%e7%94%a8%e3%81%ae%e8%a8%ad%e5%ae%9a%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%99","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/9337","title":{"rendered":"Linux\u306ebash\u306e\u5168\u30e6\u30fc\u30b6\u7528\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\uff01"},"content":{"rendered":"<p>Linux\u306ebash\u306e\u5168\u30e6\u30fc\u30b6\u7528\u306e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002RHEL 8.4\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>\u300c\/etc\/profile\u300d\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>\u300c\/etc\/profile\u300d\u306b\u306f\u3001\u4e3b\u8981\u306a\u74b0\u5883\u5909\u6570\u306e\u5b9a\u7fa9\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u300c\/etc\/profile\u300d\u306f\u3001\u300c\/etc\/bashrc\u300d\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,84]; title: ; notranslate\" title=\"\">\r\n$ cat \/etc\/profile\r\n# \/etc\/profile\r\n\r\n# System wide environment and startup programs, for login setup\r\n# Functions and aliases go in \/etc\/bashrc\r\n\r\n# It's NOT a good idea to change this file unless you know what you\r\n# are doing. It's much better to create a custom.sh shell script in\r\n# \/etc\/profile.d\/ to make custom changes to your environment, as this\r\n# will prevent the need for merging in future updates.\r\n\r\npathmunge () {\r\n    case &quot;:${PATH}:&quot; in\r\n        *:&quot;$1&quot;:*)\r\n            ;;\r\n        *)\r\n            if &#x5B; &quot;$2&quot; = &quot;after&quot; ] ; then\r\n                PATH=$PATH:$1\r\n            else\r\n                PATH=$1:$PATH\r\n            fi\r\n    esac\r\n}\r\n\r\n\r\nif &#x5B; -x \/usr\/bin\/id ]; then\r\n    if &#x5B; -z &quot;$EUID&quot; ]; then\r\n        # ksh workaround\r\n        EUID=`\/usr\/bin\/id -u`\r\n        UID=`\/usr\/bin\/id -ru`\r\n    fi\r\n    USER=&quot;`\/usr\/bin\/id -un`&quot;\r\n    LOGNAME=$USER\r\n    MAIL=&quot;\/var\/spool\/mail\/$USER&quot;\r\nfi\r\n\r\n# Path manipulation\r\nif &#x5B; &quot;$EUID&quot; = &quot;0&quot; ]; then\r\n    pathmunge \/usr\/sbin\r\n    pathmunge \/usr\/local\/sbin\r\nelse\r\n    pathmunge \/usr\/local\/sbin after\r\n    pathmunge \/usr\/sbin after\r\nfi\r\n\r\nHOSTNAME=`\/usr\/bin\/hostname 2&gt;\/dev\/null`\r\nHISTSIZE=1000\r\nif &#x5B; &quot;$HISTCONTROL&quot; = &quot;ignorespace&quot; ] ; then\r\n    export HISTCONTROL=ignoreboth\r\nelse\r\n    export HISTCONTROL=ignoredups\r\nfi\r\n\r\nexport PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL\r\n\r\n# By default, we want umask to get set. This sets it for login shell\r\n# Current threshold for system reserved uid\/gids is 200\r\n# You could check uidgid reservation validity in\r\n# \/usr\/share\/doc\/setup-*\/uidgid file\r\nif &#x5B; $UID -gt 199 ] &amp;&amp; &#x5B; &quot;`\/usr\/bin\/id -gn`&quot; = &quot;`\/usr\/bin\/id -un`&quot; ]; then\r\n    umask 002\r\nelse\r\n    umask 022\r\nfi\r\n\r\nfor i in \/etc\/profile.d\/*.sh \/etc\/profile.d\/sh.local ; do\r\n    if &#x5B; -r &quot;$i&quot; ]; then\r\n        if &#x5B; &quot;${-#*i}&quot; != &quot;$-&quot; ]; then \r\n            . &quot;$i&quot;\r\n        else\r\n            . &quot;$i&quot; &gt;\/dev\/null\r\n        fi\r\n    fi\r\ndone\r\n\r\nunset i\r\nunset -f pathmunge\r\n\r\nif &#x5B; -n &quot;${BASH_VERSION-}&quot; ] ; then\r\n        if &#x5B; -f \/etc\/bashrc ] ; then\r\n                # Bash login shells run only \/etc\/profile\r\n                # Bash non-login shells run only \/etc\/bashrc\r\n                # Check for double sourcing is done in \/etc\/bashrc.\r\n                . \/etc\/bashrc\r\n       fi\r\nfi\r\n<\/pre>\n<h2>\u300c\/etc\/bashrc\u300d\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>\u300c\/etc\/bashrc\u300d\u306f\u3001\u300c\/etc\/profile\u300d\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002\u5168\u30e6\u30fc\u30b6\u306b\u8a2d\u5b9a\u3059\u308b\u30a8\u30a4\u30ea\u30a2\u30b9\u3084\u95a2\u6570\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\n$ cat \/etc\/bashrc \r\n# \/etc\/bashrc\r\n\r\n# System wide functions and aliases\r\n# Environment stuff goes in \/etc\/profile\r\n\r\n# It's NOT a good idea to change this file unless you know what you\r\n# are doing. It's much better to create a custom.sh shell script in\r\n# \/etc\/profile.d\/ to make custom changes to your environment, as this\r\n# will prevent the need for merging in future updates.\r\n\r\n# Prevent doublesourcing\r\nif &#x5B; -z &quot;$BASHRCSOURCED&quot; ]; then\r\n  BASHRCSOURCED=&quot;Y&quot;\r\n\r\n  # are we an interactive shell?\r\n  if &#x5B; &quot;$PS1&quot; ]; then\r\n    if &#x5B; -z &quot;$PROMPT_COMMAND&quot; ]; then\r\n      case $TERM in\r\n      xterm*|vte*)\r\n        if &#x5B; -e \/etc\/sysconfig\/bash-prompt-xterm ]; then\r\n            PROMPT_COMMAND=\/etc\/sysconfig\/bash-prompt-xterm\r\n        elif &#x5B; &quot;${VTE_VERSION:-0}&quot; -ge 3405 ]; then\r\n            PROMPT_COMMAND=&quot;__vte_prompt_command&quot;\r\n        else\r\n            PROMPT_COMMAND='printf &quot;&#92;&#48;33]0;%s@%s:%s&#92;&#48;07&quot; &quot;${USER}&quot; &quot;${HOSTNAME%%.*}&quot; &quot;${PWD\/#$HOME\/\\~}&quot;'\r\n        fi\r\n        ;;\r\n      screen*)\r\n        if &#x5B; -e \/etc\/sysconfig\/bash-prompt-screen ]; then\r\n            PROMPT_COMMAND=\/etc\/sysconfig\/bash-prompt-screen\r\n        else\r\n            PROMPT_COMMAND='printf &quot;&#92;&#48;33k%s@%s:%s&#92;&#48;33\\\\&quot; &quot;${USER}&quot; &quot;${HOSTNAME%%.*}&quot; &quot;${PWD\/#$HOME\/\\~}&quot;'\r\n        fi\r\n        ;;\r\n      *)\r\n        &#x5B; -e \/etc\/sysconfig\/bash-prompt-default ] &amp;&amp; PROMPT_COMMAND=\/etc\/sysconfig\/bash-prompt-default\r\n        ;;\r\n      esac\r\n    fi\r\n    # Turn on parallel history\r\n    shopt -s histappend\r\n    history -a\r\n    # Turn on checkwinsize\r\n    shopt -s checkwinsize\r\n    &#x5B; &quot;$PS1&quot; = &quot;\\\\s-\\\\v\\\\\\$ &quot; ] &amp;&amp; PS1=&quot;&#x5B;\\u@\\h \\W]\\\\$ &quot;\r\n    # You might want to have e.g. tty in prompt (e.g. more virtual machines)\r\n    # and console windows\r\n    # If you want to do so, just add e.g.\r\n    # if &#x5B; &quot;$PS1&quot; ]; then\r\n    #   PS1=&quot;&#x5B;\\u@\\h:\\l \\W]\\\\$ &quot;\r\n    # fi\r\n    # to your custom modification shell script in \/etc\/profile.d\/ directory\r\n  fi\r\n\r\n  if ! shopt -q login_shell ; then # We're not a login shell\r\n    # Need to redefine pathmunge, it gets undefined at the end of \/etc\/profile\r\n    pathmunge () {\r\n        case &quot;:${PATH}:&quot; in\r\n            *:&quot;$1&quot;:*)\r\n                ;;\r\n            *)\r\n                if &#x5B; &quot;$2&quot; = &quot;after&quot; ] ; then\r\n                    PATH=$PATH:$1\r\n                else\r\n                    PATH=$1:$PATH\r\n                fi\r\n        esac\r\n    }\r\n\r\n    # By default, we want umask to get set. This sets it for non-login shell.\r\n    # Current threshold for system reserved uid\/gids is 200\r\n    # You could check uidgid reservation validity in\r\n    # \/usr\/share\/doc\/setup-*\/uidgid file\r\n    if &#x5B; $UID -gt 199 ] &amp;&amp; &#x5B; &quot;`\/usr\/bin\/id -gn`&quot; = &quot;`\/usr\/bin\/id -un`&quot; ]; then\r\n       umask 002\r\n    else\r\n       umask 022\r\n    fi\r\n\r\n    SHELL=\/bin\/bash\r\n    # Only display echos from profile.d scripts if we are no login shell\r\n    # and interactive - otherwise just process them to set envvars\r\n    for i in \/etc\/profile.d\/*.sh; do\r\n        if &#x5B; -r &quot;$i&quot; ]; then\r\n            if &#x5B; &quot;$PS1&quot; ]; then\r\n                . &quot;$i&quot;\r\n            else\r\n                . &quot;$i&quot; &gt;\/dev\/null\r\n            fi\r\n        fi\r\n    done\r\n\r\n    unset i\r\n    unset -f pathmunge\r\n  fi\r\n\r\nfi\r\n# vim:ts=4:sw=4\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>\u300c\/etc\/profile\u300d\u3001\u300c\/etc\/bashrc\u300d\u306f\u3001\u5404\u30e6\u30fc\u30b6\u3067\u5fc5\u305a\u5b9f\u884c\u3055\u308c\u307e\u3059\u30021\u5ea6\u3057\u3063\u304b\u308a\u78ba\u8a8d\u3057\u3066\u304a\u304f\u3068\u3001\u30b7\u30a7\u30eb\u74b0\u5883\u306b\u95a2\u3059\u308b\u7406\u89e3\u304c\u6df1\u307e\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/8974\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30b3\u30de\u30f3\u30c9\u64cd\u4f5c\u3092\u884c\u3046\uff01\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2021\/02\/fi_linux_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30b3\u30de\u30f3\u30c9\u64cd\u4f5c\u3092\u884c\u3046\uff01<\/div><div class=\"substr\">Linux\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001\u30b3\u30de\u30f3\u30c9\u64cd\u4f5c\u3092\u884c\u3046\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\uff01...<\/div><\/a><\/div>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/7679\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u3092\u4f7f\u3044\u3053\u306a\u3059\uff01\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2021\/02\/fi_linux_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u3092\u4f7f\u3044\u3053\u306a\u3059\uff01<\/div><div class=\"substr\">Linux\u3092\u4f7f\u3044\u3053\u306a\u3059\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002...<\/div><\/a><\/div>\n<h2>\u95a2\u9023\u66f8\u7c4d\uff08Amazon\uff09<\/h2>\n<p><a href=\"https:\/\/amzn.to\/3H5qkUu\" rel=\"noopener\" target=\"_blank\"><img decoding=\"async\" class=\"paapi5-pa-product-image-source lazyload\" data-src=\"https:\/\/m.media-amazon.com\/images\/I\/51ZPkoBGdZL._SL160_.jpg\" alt=\"N\/A\"><\/a><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u306ebash\u306e\u5168\u30e6\u30fc\u30b6\u7528\u306e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002RHEL 8.4\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":5527,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197],"tags":[],"class_list":["post-9337","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-login-session"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/9337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=9337"}],"version-history":[{"count":0,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/9337\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/5527"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=9337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=9337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=9337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}