{"id":1483,"date":"2020-01-22T22:45:49","date_gmt":"2020-01-22T13:45:49","guid":{"rendered":"https:\/\/oboki.net\/workspace\/?p=1483"},"modified":"2020-01-29T22:47:43","modified_gmt":"2020-01-29T13:47:43","slug":"prompt-statement-ps1-ps2-ps4","status":"publish","type":"post","link":"https:\/\/oboki.net\/workspace\/system\/linux\/prompt-statement-ps1-ps2-ps4\/","title":{"rendered":"[Linux] PROMPT STATEMENT &#8211; PS1, PS2, &#8230;, PS4"},"content":{"rendered":"<p>\ub9e5 \uae30\ubcf8 \ud130\ubbf8\ub110 \uae30\ubcf8 \uc124\uc815\uc758 PS1\uc740 \ud604\uc7ac \uc704\uce58\ub97c \ubcf4\uc5ec\uc8fc\uc9c0 \uc54a\ub294\ub2e4. \uac1c\uc778\uc801\uc73c\ub85c \uc6b0\ubd84\ud22c\uc5d0\uc11c\uc758, scp remote \uacbd\ub85c\uc640 \ube44\uc2b7\ud55c, \ud615\ud0dc\ub97c \uc88b\uc544\ud558\uae30 \ub54c\ubb38\uc5d0 \uc6b0\ubd84\ud22c\uc5d0\uc11c\uc758 \uac83\ucc98\ub7fc \ubc14\uafd4\ub450\uc5c8\ub294\ub370 (<code>export PS1=&quot;\\h:\\W \\u\\\\$&quot;<\/code>) Linux\uc640 Mac \uc5d0\uc11c\uc758 \uae30\ubcf8 <code>PS1<\/code> \uc124\uc815\uc740 \ub2e4\uc74c\uacfc \uac19\uace0<\/p>\n<ul>\n<li>Linux\n<ul>\n<li><code>\\s-\\v\\$<\/code><\/li>\n<\/ul>\n<\/li>\n<li>Ubuntu\n<ul>\n<li><code>\\h:\\W \\u\\\\$<\/code><\/li>\n<\/ul>\n<\/li>\n<li>Mac\n<ul>\n<li><code>[\\u@\\h \\W]\\$<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><code>PS1<\/code> \uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ud3ec\ub9e4\ud130\ub294 \uc544\ub798\uc640 \uac19\uc740 \uac83\ub4e4\uc774 \uc788\ub2e4.<\/p>\n<table>\n<thead>\n<tr>\n<th>Expression<\/th>\n<th>Output<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>\\t<\/code><\/td>\n<td>24\uc2dc \ub2e8\uc704 \uc2dc\uac04<\/td>\n<\/tr>\n<tr>\n<td><code>\\T<\/code><\/td>\n<td>12\uc2dc \ub2e8\uc704 \uc2dc\uac04<\/td>\n<\/tr>\n<tr>\n<td><code>\\@<\/code><\/td>\n<td>12\uc2dc \ub2e8\uc704 \uc2dc\uac04 \ubc0f \uc624\uc804\/\uc624\ud6c4 \ud45c\uae30<\/td>\n<\/tr>\n<tr>\n<td><code>\\d<\/code><\/td>\n<td>\ud604\uc7ac \ub0a0\uc9dc<\/td>\n<\/tr>\n<tr>\n<td><code>\\s<\/code><\/td>\n<td>\ud604\uc7ac \uc0ac\uc6a9\uc911\uc778 \uc258<\/td>\n<\/tr>\n<tr>\n<td><code>\\w<\/code><\/td>\n<td>\ud604\uc7ac \ub514\ub809\ud1a0\ub9ac \uc808\ub300 \uacbd\ub85c<\/td>\n<\/tr>\n<tr>\n<td><code>\\W<\/code><\/td>\n<td>\ud604\uc7ac \ub514\ub809\ud1a0\ub9ac<\/td>\n<\/tr>\n<tr>\n<td><code>\\u<\/code><\/td>\n<td>\uc0ac\uc6a9\uc790\uba85<\/td>\n<\/tr>\n<tr>\n<td><code>\\h<\/code><\/td>\n<td>\ud638\uc2a4\ud2b8\uba85<\/td>\n<\/tr>\n<tr>\n<td><code>\\H<\/code><\/td>\n<td>\ub3c4\uba54\uc778\uba85<\/td>\n<\/tr>\n<tr>\n<td><code>\\#<\/code><\/td>\n<td>\uc0ac\uc6a9\ud55c \uba85\ub839\uc5b4 \ud788\uc2a4\ud1a0\ub9ac<\/td>\n<\/tr>\n<tr>\n<td><code>\\!<\/code><\/td>\n<td>\uc0ac\uc6a9\ud55c \uba85\ub839\uc5b4 \ud788\uc2a4\ud1a0\ub9ac\uc758 \ubc88\ud638<\/td>\n<\/tr>\n<tr>\n<td><code>\\$<\/code><\/td>\n<td>\ud604\uc7ac \uc0ac\uc6a9\uc790\uac00 root \uc778 \uacbd\uc6b0 # \ubb38\uc790 \uc77c\ubc18 \uc0ac\uc6a9\uc790\uc778 \uacbd\uc6b0 $ \ubb38\uc790<\/td>\n<\/tr>\n<tr>\n<td><code>\\n<\/code><\/td>\n<td>\uac1c\ud589<\/td>\n<\/tr>\n<tr>\n<td><code>\\r<\/code><\/td>\n<td>\uce90\ub9ac\uc9c0 \ub9ac\ud134<\/td>\n<\/tr>\n<tr>\n<td><code>\\v<\/code><\/td>\n<td>\uc258 \ubc84\uc804<\/td>\n<\/tr>\n<tr>\n<td><code>\\V<\/code><\/td>\n<td>\uc258 \ubc84\uc804 \uc0c1\uc138<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n<p>\uc9c0\uae08\uae4c\uc9c0 <code>PS1<\/code>\uc740 \uadf8\ub0e5 \uc258 \ud658\uacbd\uc5d0\uc11c \ud604\uc7ac \uc0c1\ud0dc\ub97c \ubcf4\uc5ec\uc8fc\ub294 \ud658\uacbd\ubcc0\uc218\uc774\uace0 \uc815\ud574\uc9c4 \ud3ec\ub9e4\ud130\ub85c \ucee4\uc2a4\ud140\ud560 \uc218 \uc788\uad6c\ub098\ud558\uace0 \uc0dd\uac01\ud588\uc5c8\ub294\ub370 \uac11\uc9c0\uac00 <code>PS<\/code>\ub294 \ubb34\uc2a8 \ub73b\uc774\uc9c0? <code>1<\/code>\uc774 \uc788\uc73c\uba74 <code>2<\/code>\ub3c4 \uc788\ub294\uac74\uac00 \ud558\ub294 \uc0dd\uac01\uc774 \ub4e4\uc5c8\ub2e4.<\/p>\n<p>\ucc3e\uc544\ubcf4\ub2c8 <code>PS<\/code>\ub294 <code>PROMPT STATEMENT<\/code>\uc758 \uc900\ub9d0\uc774\uc5c8\uace0 <code>PS1<\/code> \uc678\uc5d0\ub3c4 <code>PS2<\/code>,<code>PS3<\/code>,<code>PS4<\/code> \uc5d0\ub2e4\uac00 <code>PROMPT_COMMAND<\/code> \uae4c\uc9c0 \ud574\uc11c \ud504\ub86c\ud504\ud2b8\ub97c \uc0ac\uc6a9\uc790\uc815\uc758\ud560 \uc218 \uc788\uac8c \ud558\ub294 \ud658\uacbd\ubcc0\uc218\ub4e4\uc774 \uc788\uc5c8\ub2e4. \uc544\ub798 \ub9c1\ud06c\uc5d0\uc11c \ubcf4\ub2e4 \uc790\uc138\ud55c \uc124\uba85\uacfc \uac04\ub2e8\ud55c \uc0d8\ud50c\ub4e4\uc740 \ud655\uc778\ud560 \uc218 \uc788\ub2e4.<\/p>\n<p><a href=\"https:\/\/www.thegeekstuff.com\/2008\/09\/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command\/\">https:\/\/www.thegeekstuff.com\/2008\/09\/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command\/<\/a><\/p>\n<p>\uc694\uc57d\ud558\uba74 \uc544\ub798\uc640 \uac19\uc740 \uc6a9\ub3c4\ub85c \uc0ac\uc6a9\ud558\ub294 \uac83 \uac19\ub2e4.<\/p>\n<ul>\n<li>PS1\n<ul>\n<li>\uc258 \ud604\uc7ac \uc0c1\ud0dc \uc815\ubcf4<\/li>\n<\/ul>\n<\/li>\n<li>PS2\n<ul>\n<li>for, select \ubb38\uc744 \uc0ac\uc6a9\ud558\uac70\ub098 \uc774\uc2a4\ucf00\uc774\ud504\ub85c \uac1c\ud589\ud558\ub294 \ub4f1 \uba40\ud2f0\ub77c\uc778 \ucee4\ub9e8\ub4dc\uc778 \uacbd\uc6b0\ub97c \uc2dd\ubcc4<\/li>\n<\/ul>\n<\/li>\n<li>PS3\n<ul>\n<li>bash <code>select<\/code> \ubb38\uc5d0\uc11c \ud504\ub86c\ud504\ud2b8 \ub420 \ubb38\uc7a5<\/li>\n<\/ul>\n<\/li>\n<li>PS4\n<ul>\n<li>\ub514\ubc84\uae45 \ubaa9\uc801\uc73c\ub85c <code>set -x<\/code> \uac00 \ud65c\uc131\ud654\ub3fc \uc788\uc744 \ub54c \ucd94\uac00 \uc815\ubcf4 \uc81c\uacf5<\/li>\n<\/ul>\n<\/li>\n<li>PROMPT_COMMAND\n<ul>\n<li><code>PS1<\/code> \uc5d0 \uc55e\uc11c \uc2e4\ud589\ub420 \uba85\ub839<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\uc258 \ud504\ub85c\uadf8\ub798\ubc0d\uc744 \ud558\uac70\ub098 \uc6b4\uc601 \ud658\uacbd\uc5d0 \uc81c\uc57d\uc744 \uac78\uace0\uc790 \ud560 \ub54c \uc720\uc6a9\ud558\uac8c \uc4f8 \uc218 \uc788\uc744 \uac83 \uac19\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub9e5 \uae30\ubcf8 \ud130\ubbf8\ub110 \uae30\ubcf8 \uc124\uc815\uc758 PS1\uc740 \ud604\uc7ac \uc704\uce58\ub97c \ubcf4\uc5ec\uc8fc\uc9c0 \uc54a\ub294\ub2e4. \uac1c\uc778\uc801\uc73c\ub85c \uc6b0\ubd84\ud22c\uc5d0\uc11c\uc758, scp remote \uacbd\ub85c\uc640 \ube44\uc2b7\ud55c, \ud615\ud0dc\ub97c \uc88b\uc544\ud558\uae30 \ub54c\ubb38\uc5d0 \uc6b0\ubd84\ud22c\uc5d0\uc11c\uc758 \uac83\ucc98\ub7fc \ubc14\uafd4\ub450\uc5c8\ub294\ub370 (export PS1=&quot;\\h:\\W \\u\\\\$&quot;) Linux\uc640 Mac \uc5d0\uc11c\uc758 \uae30\ubcf8 PS1 \uc124\uc815\uc740 \ub2e4\uc74c\uacfc \uac19\uace0 Linux \\s-\\v\\$ Ubuntu \\h:\\W \\u\\\\$ Mac [\\u@\\h \\W]\\$ PS1 \uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ud3ec\ub9e4\ud130\ub294 \uc544\ub798\uc640 \uac19\uc740 \uac83\ub4e4\uc774 \uc788\ub2e4. Expression Output \\t 24\uc2dc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166,3],"tags":[],"class_list":["post-1483","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux"],"_links":{"self":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/1483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/comments?post=1483"}],"version-history":[{"count":0,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/1483\/revisions"}],"wp:attachment":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/media?parent=1483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/categories?post=1483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/tags?post=1483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}