{"id":193,"date":"2014-11-23T12:09:39","date_gmt":"2014-11-23T03:09:39","guid":{"rendered":"http:\/\/teraterm.feasible-lab.com\/?p=193"},"modified":"2024-04-24T17:19:27","modified_gmt":"2024-04-24T08:19:27","slug":"5-4-tera-term-getdate","status":"publish","type":"post","link":"https:\/\/teraterm.feasible-lab.com\/?p=193","title":{"rendered":"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046"},"content":{"rendered":"<h2>5.4.1. \u5909\u6570\u3092\u5fdc\u7528\u3057\u3066\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u8a2d\u5b9a<\/h2>\n<p><a title=\"5.3. \u63a5\u7d9a\u5148IP\u3082\u5909\u6570\u306b\u3057\u3088\u3046\" href=\"http:\/\/teraterm.feasible-lab.com\/5-3-tera-term-strconcat\/\" target=\"_blank\" rel=\"noopener\">\u524d\u56de<\/a>\u307e\u3067\u3067\u3001\u5909\u6570\u306b\u5bfe\u3059\u308b\u62b5\u6297\u611f\u306f\u6b86\u3069\u306a\u304f\u306a\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3055\u3089\u306b\u5909\u6570\u3092\u5fdc\u7528\u3057\u3066\u3001\u30de\u30af\u30ed\u3092\u3082\u3063\u3068\u4f7f\u3044\u3084\u3059\u304f\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>5.4.1.1. \u524d\u56de\u307e\u3067\u306b\u4f5c\u6210\u3057\u305f\u30de\u30af\u30ed\u306e\u632f\u308a\u8fd4\u308a<\/h3>\n<p>\u4ee5\u4e0b\u306f\u524d\u56de\u307e\u3067\u306b\u4f5c\u6210\u3057\u305f\u30de\u30af\u30ed\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">;=================================\r\n;\u5909\u6570\u683c\u7d0d\r\n;=================================\r\nPWD = 'cisco123'\r\nIP_ADDR = '172.16.0.1'\r\n\r\n\r\n;IP\u30a2\u30c9\u30ec\u30b9\u306b\u5fc5\u8981\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3059\u308b\r\nstrconcat IP_ADDR ':23 \/nossh \/T=1'\r\n\r\n\r\n;=================================\r\n;telnet\u63a5\u7d9a\u3001\u30ed\u30b0\u4fdd\u5b58\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n;=================================\r\nconnect IP_ADDR\r\ngetdir DIR\r\nchangedir DIR\r\n\r\n\r\n;=================================\r\n;show run\u306e\u30ed\u30b0\u3092\u53d6\u5f97\r\n;=================================\r\nlogopen 'show_run.log' 0 0\r\n\r\n  wait 'Password:'\r\n sendln PWD\r\n  wait '&gt;'\r\n   pause 3\r\n sendln 'en'\r\n  wait 'Password'\r\n   pause 3\r\n sendln PWD\r\n  wait '#'\r\n   pause 3\r\n sendln 'terminal length 0'\r\n  wait '#'\r\n   pause 3\r\n sendln 'show run'\r\n   pause 5\r\n sendln ''\r\n  wait '#'\r\n\r\nlogclose\r\n\r\n;=================================\r\n;show log\u306e\u30ed\u30b0\u3092\u53d6\u5f97\r\n;=================================\r\nlogopen 'show_log.log' 0 0\r\n\r\n sendln 'show log'\r\n   pause 5\r\n sendln ''\r\n  wait '#'\r\n sendln 'exit'\r\n\r\nend<\/pre>\n<p>\u3044\u3088\u3044\u3088\u30de\u30af\u30ed\u304c\u9577\u304f\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u3055\u3066\u3001\u3053\u308c\u307e\u3067\u30de\u30af\u30ed\u3092\u8d70\u3089\u305b\u3066\u304d\u3066\u3001\u300c\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u300d\u306e\u4e0d\u4fbf\u306a\u3068\u3053\u308d\u306f\u306a\u304b\u3063\u305f\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>&nbsp;<\/p>\n<h3>5.4.1.2. \u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u30e6\u30cb\u30fc\u30af\u306b\u3059\u308b<\/h3>\n<p>\u30de\u30af\u30ed\u3092\u8d70\u3089\u305b\u308b\u305f\u3073\u306b\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u3051\u3069\u3001\u300c\u30ed\u30b0\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u6bce\u56de\u540c\u3058\u3060\u304b\u3089\u3001\u4e0a\u66f8\u304d\u3055\u308c\u3066\u3057\u307e\u3046\u300d\u3068\u3044\u3046\u72b6\u6cc1\u304c\u8d77\u304d\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u4eca\u56de\u306f\u5909\u6570\u3001strconcat\u3001\u65b0\u305f\u306a\u30b3\u30de\u30f3\u30c9\u306e\u4ed5\u7d44\u307f\u3092\u4f7f\u3063\u3066\u3001\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u30e6\u30cb\u30fc\u30af\u306a\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u3064\u3051\u3066\u3044\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30e6\u30cb\u30fc\u30af\u306a\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u8a00\u3063\u3066\u3082\u3001\u4f55\u3092\u3064\u3051\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u4e00\u822c\u7684\u306b\u904b\u7528\u306e\u4e2d\u3067\u7528\u3044\u3089\u308c\u308b\u306e\u306f\u3001\u30ed\u30b0\u3092\u53d6\u5f97\u3057\u305f\u300c\u65e5\u4ed8\u300d\u3084\u300c\u6642\u9593\u300d\u3067\u3059\u3002<\/p>\n<p>\u65e5\u4ed8\u3068\u6642\u9593\u3092\u7d30\u304b\u304f\u3064\u3051\u308c\u3070\u3064\u3051\u308b\u307b\u3069\u3001\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u4e00\u610f\u6027\u304c\u751f\u307e\u308c\u307e\u3059\u3057\u3001\u4e0a\u66f8\u304d\u3055\u308c\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u53cd\u9762\u3001\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u9577\u304f\u306a\u308b\u3001\u306a\u3069\u306e\u5f0a\u5bb3\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u3059\u304b\u3089\u3001\u6700\u3082\u9577\u3044\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u5b66\u7fd2\u3057\u3066\u304a\u3044\u3066\u3001\u72b6\u6cc1\u306b\u5408\u308f\u305b\u3066\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u77ed\u304f\u3059\u308b\u624b\u6cd5\u3092\u3068\u308b\u306e\u304c\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>5.4.2. \u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u4f7f\u3046<\/h2>\n<p>\u65e5\u4ed8\u3092\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u9069\u7528\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u30de\u30af\u30ed\u304c\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u3057\u3066\u65e5\u4ed8\u3092\u683c\u7d0d\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30de\u30af\u30ed\u81ea\u4f53\u304c\u73fe\u5728\u306e\u65e5\u6642\u3092\u77e5\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>5.4.2.1. \u65e5\u4ed8\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30de\u30f3\u30c9<\/h3>\n<p>\u524d\u56de\u306egetdir\u30b3\u30de\u30f3\u30c9\u3067\u884c\u3063\u305f\u3088\u3046\u306b\u3001\u65e5\u4ed8\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u524d\u56de\u306egetdir\u30b3\u30de\u30f3\u30c9\u3092\u8efd\u304f\u304a\u3055\u3089\u3044\u3059\u308b\u3068\u3001<\/p>\n<pre class=\"lang:default decode:true\">getdir DIR<\/pre>\n<p>\u3067DIR\u5909\u6570\u306b\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u683c\u7d0d\u3057\u3066\u304f\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>getdir\u3068\u540c\u3058\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u3001\u73fe\u5728\u306e\u65e5\u6642\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001<\/p>\n<pre class=\"lang:default decode:true\">getdate \u65e5\u4ed8\u3092\u683c\u7d0d\u3059\u308b\u5909\u6570\u540d \u578b<\/pre>\n<p>\u3068<\/p>\n<pre class=\"lang:default decode:true\">gettime \u6642\u9593\u3092\u683c\u7d0d\u3059\u308b\u5909\u6570\u540d \u578b\r\n<\/pre>\n<p>\u3068\u3044\u3046\u4e8c\u3064\u306e\u30b3\u30de\u30f3\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>getdate\u30b3\u30de\u30f3\u30c9\u3082gettime\u30b3\u30de\u30f3\u30c9\u3082\u3001\u5909\u6570\u540d\u306e\u5f8c\u308d\u306b\u5f62\u5f0f\u3092\u8a18\u8f09\u3059\u308c\u3070\u3001\u73fe\u5728\u306e\u65e5\u4ed8\uff0b\u6642\u9593\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u57fa\u672c\u7684\u306b\u306f\u540c\u3058\u52d5\u4f5c\u3092\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3060\u3068\u8003\u3048\u3066\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u79c1\u306e\u5834\u5408\u3001getdate\u30b3\u30de\u30f3\u30c9\u306e\u65b9\u304c\u4f7f\u3044\u6163\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u57fa\u672c\u7684\u306b\u306fgetdate\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002gettime\u30b3\u30de\u30f3\u30c9\u306f\u30b3\u30de\u30f3\u30c9\u6587\u306e\u4e2d\u3067t\u304c\u91cd\u306a\u308b\u306e\u3067\u3001\u30bf\u30a4\u30d7\u3057\u3065\u3089\u3044\u3068\u3044\u3046\u3068\u3053\u308d\u3082\u3042\u308a\u307e\u3059\u3057\u3001\u8aad\u307f\u306b\u304f\u3044\u306e\u3067\u3042\u307e\u308a\u4f7f\u7528\u3057\u307e\u305b\u3093\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>5.4.2.2. getdate\u30b3\u30de\u30f3\u30c9\u3067\u65e5\u6642\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306bgetdate\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>getdate\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001DATE\u3068\u3044\u3046\u5909\u6570\u306b\u3001\u73fe\u5728\u306e\u65e5\u6642\u3092\u683c\u7d0d\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">getdate DATE<\/pre>\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u8d70\u3089\u305b\u308b\u3068\u3001DATE\u5909\u6570\u5185\u306b\u306f\u3001\u300eYYYY-MM-DD\u300f\u306e\u5f62\u5f0f\u3067\u3001\u65e5\u4ed8\u304c\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>2014\u5e7411\u670822\u65e5\u306b\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u8d70\u3089\u305b\u305f\u5834\u5408\u3001\u300e2014-11-22\u300f\u306e\u5f62\u3067\u6587\u5b57\u5217\u304c\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u65e5\u4ed8\u3060\u3051\u683c\u7d0d\u3059\u308b\u5834\u5408\u306f\u3053\u308c\u3067\u554f\u984c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u65e5\u4ed8\u306e\u771f\u3093\u4e2d\u306e\u30cf\u30a4\u30d5\u30f3\u304c\u3044\u3089\u306a\u3044\u306a\u3042\u3068\u3044\u3046\u306e\u3068\u3001\u6642\u523b\u3082\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u52a0\u3048\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u5f62\u5f0f\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u969b\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u578b\u3092\u5b9a\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u578b\u306f\u3044\u304f\u3064\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u3066\u899a\u3048\u306b\u304f\u3044\u3088\u3046\u306b\u601d\u3044\u307e\u3059\u304c\u3001\u5b9f\u306f\u7c21\u5358\u3067\u3059\u3002<\/p>\n<p>\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u3067\u306f&#8221;YymdHMS&#8221;\u306e7\u3064\u3060\u3051\u899a\u3048\u3066\u304a\u3051\u3070\u3044\u3044\u3067\u3059\u3002\u4ed6\u306b\u3082\u8272\u3005\u306a\u578b\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u307b\u3068\u3093\u3069\u4f7f\u3063\u3066\u3044\u308b\u306e\u3092\u898b\u305f\u4e8b\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u79c1\u3068\u3057\u3066\u306f\u3001\u305d\u3093\u306a\u4f7f\u308f\u306a\u3044\u578b\u3092\u899a\u3048\u308b\u306e\u306b\u52b4\u529b\u3092\u4f7f\u3046\u306e\u306f\u3082\u3063\u305f\u3044\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u6700\u4f4e\u9650\u3060\u3051\u899a\u3048\u3066\u304a\u3051\u3070\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>5.4.2.3. getdate\u30b3\u30de\u30f3\u30c9\u3067\u4f7f\u308f\u308c\u308b\u578b<\/h3>\n<p>\u3067\u306f\u3001\u4e00\u89a7\u306b\u3057\u3066\u8a18\u8ff0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u4eee\u306b\u3001\u73fe\u5728\u65e5\u6642\u30922014\/11\/22 01:23:45\u3060\u3068\u3057\u307e\u3059\u3002<\/p>\n<table style=\"background-color: #ffffff;\">\n<tbody>\n<tr>\n<td>\u578b<\/td>\n<td>\u5f62\u5f0f<\/td>\n<td>\u30b5\u30f3\u30d7\u30eb<\/td>\n<\/tr>\n<tr>\n<td>%Y<\/td>\n<td>\u5e74YYYY<\/td>\n<td>2014<\/td>\n<\/tr>\n<tr>\n<td>%y<\/td>\n<td>\u5e74YY(\u4e0b\u4e8c\u6841\uff09<\/td>\n<td>14<\/td>\n<\/tr>\n<tr>\n<td>%m<\/td>\n<td>\u6708\uff08\u4e8c\u6841\uff09<\/td>\n<td>11<\/td>\n<\/tr>\n<tr>\n<td>%d<\/td>\n<td>\u65e5\uff08\u4e8c\u6841\uff09<\/td>\n<td>22<\/td>\n<\/tr>\n<tr>\n<td>%H<\/td>\n<td>\u6642\uff08\u4e8c\u6841\uff09<\/td>\n<td>01<\/td>\n<\/tr>\n<tr>\n<td>%M<\/td>\n<td>\u5206\uff08\u4e8c\u6841\uff09<\/td>\n<td>23<\/td>\n<\/tr>\n<tr>\n<td>%S<\/td>\n<td>\u79d2\uff08\u4e8c\u6841\uff09<\/td>\n<td>45<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u5b9f\u969b\u306b\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u3067\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">getdate DATE '%y%m%d-%H%M%S'<\/pre>\n<p>DATE\u306b\u683c\u7d0d\u3055\u308c\u308b\u5024\u306f\u3001&#8217;141122-012345&#8217;\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">getdate DATE '%Y-%m-%d--%H-%M-%S'<\/pre>\n<p>DATE\u306b\u683c\u7d0d\u3055\u308c\u308b\u5024\u306f\u3001&#8217;2014-11-22&#8211;01-23-45&#8217;\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u79c1\u306f\u500b\u4eba\u7684\u306b_(\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2)\u304c\u597d\u304d\u306a\u306e\u3067\u3001\u3044\u3064\u3082\u4e0b\u8a18\u306e\u578b\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">getdate DATE '%Y%m%d_%H%M%S'<\/pre>\n<p>&nbsp;<\/p>\n<p>\u305b\u3044\u305c\u304410\u5206\u306b\u4e00\u56de\u3057\u304b\u30ed\u30b0\u3092\u3068\u3089\u306a\u3044\u3088\u3046\u306a\u5834\u5408\u306f\u3001<\/p>\n<pre class=\"lang:default decode:true\">getdate DATE '%Y%m%d_%H%M'<\/pre>\n<p>\u306e\u3088\u3046\u306a\u5f62\u3067\u3001\u79d2\u3092\u578b\u306b\u542b\u3081\u306a\u3051\u308c\u3070\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u77ed\u304f\u3059\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u4e0a\u8a18\u306e\u5834\u5408\u3001DATE\u306b\u683c\u7d0d\u3055\u308c\u308b\u5024\u306f\u3001&#8217;20141122_0123&#8217;\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>5.4.2.4. getdate\u3092\u5b9f\u969b\u306b\u4f7f\u3046<\/h3>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30de\u30af\u30ed\u306e\u4e2d\u306b\u53d6\u308a\u8fbc\u3093\u3067\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4eca\u56de\u3001\u6700\u7d42\u7684\u306b\u76ee\u6307\u3059\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u3068\u3057\u3066\u306f&#8217;show_run_20141122_012345.log&#8217;\u306e\u3088\u3046\u306a\u5f62\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u307e\u305a\u3001getdate\u30b3\u30de\u30f3\u30c9\u3067<\/p>\n<pre class=\"lang:default decode:true\">getdate DATE '%Y%m%d_%H%M%S.log'<\/pre>\n<p>\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u3064\u3051\u308b\u65e5\u6642\u3092\u53d6\u5f97\u3057\u3001\u305d\u306e\u578b\u3092\u6c7a\u3081\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u6642\u70b9\u3067.log\u3068\u3044\u3046\u62e1\u5f35\u5b50\u3082\u578b\u306e\u4e2d\u306b\u542b\u3081\u3066\u3057\u307e\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6b21\u306b\u3001&#8217;show_run_&#8217;\u3092\u5909\u6570\u5ba3\u8a00\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001&#8217;show_run&#8217;\u5206\u3068\u3001&#8217;show_log&#8217;\u5206\u306e\u4e8c\u3064\u3092\u5909\u6570\u5ba3\u8a00\u3059\u308b\u4e8b\u306b\u3057\u307e\u3059\u3002\u5909\u6570\u540d\u306fSHRUN\u3068SHLOG\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true\">SHRUN = 'show_run_'\r\nSHLOG = 'show_log_'<\/pre>\n<p>\u3053\u3053\u307e\u3067\u66f8\u3051\u305f\u3089\u3001\u305d\u308c\u305e\u308c\u306e\u30ed\u30b0\u3068DATE\u3092strconcat\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true\">strconcat SHRUN DATE\r\nstrconcat SHLOG DATE<\/pre>\n<p>\u3053\u308c\u3067\u3001SHRUN\u3068SHLOG\u306b\u306f<\/p>\n<p>&#8216;show_run_20141122_012345.log&#8217;<br \/>\n&#8216;show_log_20141122_012345.log&#8217;<\/p>\n<p>\u304c\u3001\u305d\u308c\u305e\u308c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>5.4.2.5. \u30de\u30af\u30ed\u306e\u4e2d\u306bgetdate\u3092\u7d44\u307f\u8fbc\u3080<\/h3>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30de\u30af\u30ed\u306b\u7d44\u307f\u8fbc\u3093\u3067\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default mark:20-28,36,61 decode:true\">;=================================\r\n;\u5909\u6570\u683c\u7d0d\r\n;=================================\r\nPWD = 'ciscoshun'\r\nIP_ADDR = '172.16.1.2'\r\n\r\n\r\n;IP\u30a2\u30c9\u30ec\u30b9\u306b\u5fc5\u8981\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3059\u308b\r\nstrconcat IP_ADDR ':23 \/nossh \/T=1'\r\n\r\n\r\n;=================================\r\n;telnet\u63a5\u7d9a\u3001\u30ed\u30b0\u4fdd\u5b58\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n;=================================\r\nconnect IP_ADDR\r\ngetdir DIR\r\nchangedir DIR\r\n\r\n\r\n;=================================\r\n;\u30ed\u30b0\u4fdd\u5b58\u540d\u306e\u78ba\u5b9a\r\n;=================================\r\ngetdate DATE '%Y%m%d-%H%M%S.log'\r\nSHRUN = 'show_run_'\r\nSHLOG = 'show_log_'\r\n\r\nstrconcat SHRUN DATE\r\nstrconcat SHLOG DATE\r\n\r\n\r\n\r\n\r\n;=================================\r\n;show run\u306e\u30ed\u30b0\u3092\u53d6\u5f97\r\n;=================================\r\nlogopen SHRUN 0 0\r\n\r\n  wait 'Password:'\r\n sendln PWD\r\n  wait '&gt;'\r\n   pause 3\r\n sendln 'en'\r\n  wait 'Password'\r\n   pause 3\r\n sendln PWD\r\n  wait '#'\r\n   pause 3\r\n sendln 'terminal length 0'\r\n  wait '#'\r\n   pause 3\r\n sendln 'show run'\r\n   pause 5\r\n sendln ''\r\n  wait '#'\r\n\r\nlogclose\r\n\r\n;=================================\r\n;show log\u306e\u30ed\u30b0\u3092\u53d6\u5f97\r\n;=================================\r\nlogopen SHLOG 0 0\r\n\r\n sendln 'show log'\r\n   pause 5\r\n sendln ''\r\n  wait '#'\r\n sendln 'exit'\r\n\r\nend<\/pre>\n<p>20\u304b\u308928\u884c\u76ee\u306b\u30ed\u30b0\u4fdd\u5b58\u540d\u3092\u78ba\u5b9a\u3059\u308b\u5909\u6570\u5ba3\u8a00\u3068\u3001\u30b3\u30e1\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001logopen\u30b3\u30de\u30f3\u30c9\u306e\u30ed\u30b0\u540d\u3092\u305d\u308c\u3089\u306e\u5909\u6570\u306b\u7f6e\u304d\u63db\u3048\u3066\u3044\u308b\u306e\u304c\u300136\u884c\u76ee\u306861\u884c\u76ee\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30de\u30af\u30ed\u304c\u304b\u306a\u308a\u8907\u96d1\u306a\u52d5\u304d\u3092\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u30b9\u30c6\u30c3\u30d7\u3092\u8e0f\u3093\u3067\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u3066\u304d\u305f\u306e\u3067\u3001\u8aad\u307f\u8fd4\u3057\u3066\u3082\u308f\u304b\u3089\u306a\u3044\u7b87\u6240\u3068\u3044\u3046\u306e\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u306e\u3069\u5fd8\u308c\u306f\u8ab0\u306b\u3067\u3082\u3042\u308a\u307e\u3059\u3057\u3001\u305d\u3053\u306f\u3086\u3063\u304f\u308a\u632f\u308a\u8fd4\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u6b21\u7ae0\u304b\u3089\u306f\u3001\u3044\u3088\u3044\u3088\u3001\u521d\u5fc3\u8005\u6bba\u3057\u3068\u8a00\u308f\u308c\u308b\u300e\u30eb\u30fc\u30d7\u300f\u51e6\u7406\u306b\u5165\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t<![CDATA[]]>\t\t<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,35],"tags":[],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-05-tera-term-var","category-05-4-tera-term-log-file-name"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046 - \u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/teraterm.feasible-lab.com\/?p=193\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046 - \u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed\" \/>\n<meta property=\"og:url\" content=\"https:\/\/teraterm.feasible-lab.com\/?p=193\" \/>\n<meta property=\"og:site_name\" content=\"\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-23T03:09:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-24T08:19:27+00:00\" \/>\n<meta name=\"author\" content=\"Shunsuke Yoshikawa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shunsuke Yoshikawa\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193\"},\"author\":{\"name\":\"Shunsuke Yoshikawa\",\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/#\\\/schema\\\/person\\\/e37c225a001d2e04f83152790d000c65\"},\"headline\":\"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046\",\"datePublished\":\"2014-11-23T03:09:39+00:00\",\"dateModified\":\"2024-04-24T08:19:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193\"},\"wordCount\":84,\"commentCount\":0,\"articleSection\":[\"05. \u5909\u6570\u3092\u4f7f\u3063\u3066\u3044\u3053\u3046\",\"05.4. Log\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u308b\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193\",\"url\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193\",\"name\":\"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046 - \u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/#website\"},\"datePublished\":\"2014-11-23T03:09:39+00:00\",\"dateModified\":\"2024-04-24T08:19:27+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/#\\\/schema\\\/person\\\/e37c225a001d2e04f83152790d000c65\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?p=193#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/#website\",\"url\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/\",\"name\":\"\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed\",\"description\":\"Teraterm\u30de\u30af\u30ed\u3067\u65e5\u3005\u306e\u4ed5\u4e8b\u3092\u697d\u306b\u3057\u307e\u3057\u3087\u3046\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/#\\\/schema\\\/person\\\/e37c225a001d2e04f83152790d000c65\",\"name\":\"Shunsuke Yoshikawa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/50ab8703b04a9ec3a59e1459091a462d3233d120549dac001854c8892741e6ee?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/50ab8703b04a9ec3a59e1459091a462d3233d120549dac001854c8892741e6ee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/50ab8703b04a9ec3a59e1459091a462d3233d120549dac001854c8892741e6ee?s=96&d=mm&r=g\",\"caption\":\"Shunsuke Yoshikawa\"},\"url\":\"https:\\\/\\\/teraterm.feasible-lab.com\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046 - \u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/teraterm.feasible-lab.com\/?p=193","og_locale":"ja_JP","og_type":"article","og_title":"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046 - \u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed","og_url":"https:\/\/teraterm.feasible-lab.com\/?p=193","og_site_name":"\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed","article_published_time":"2014-11-23T03:09:39+00:00","article_modified_time":"2024-04-24T08:19:27+00:00","author":"Shunsuke Yoshikawa","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"Shunsuke Yoshikawa","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"2\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/teraterm.feasible-lab.com\/?p=193#article","isPartOf":{"@id":"https:\/\/teraterm.feasible-lab.com\/?p=193"},"author":{"name":"Shunsuke Yoshikawa","@id":"https:\/\/teraterm.feasible-lab.com\/#\/schema\/person\/e37c225a001d2e04f83152790d000c65"},"headline":"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046","datePublished":"2014-11-23T03:09:39+00:00","dateModified":"2024-04-24T08:19:27+00:00","mainEntityOfPage":{"@id":"https:\/\/teraterm.feasible-lab.com\/?p=193"},"wordCount":84,"commentCount":0,"articleSection":["05. \u5909\u6570\u3092\u4f7f\u3063\u3066\u3044\u3053\u3046","05.4. Log\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u308b"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/teraterm.feasible-lab.com\/?p=193#respond"]}]},{"@type":"WebPage","@id":"https:\/\/teraterm.feasible-lab.com\/?p=193","url":"https:\/\/teraterm.feasible-lab.com\/?p=193","name":"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046 - \u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed","isPartOf":{"@id":"https:\/\/teraterm.feasible-lab.com\/#website"},"datePublished":"2014-11-23T03:09:39+00:00","dateModified":"2024-04-24T08:19:27+00:00","author":{"@id":"https:\/\/teraterm.feasible-lab.com\/#\/schema\/person\/e37c225a001d2e04f83152790d000c65"},"breadcrumb":{"@id":"https:\/\/teraterm.feasible-lab.com\/?p=193#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/teraterm.feasible-lab.com\/?p=193"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/teraterm.feasible-lab.com\/?p=193#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/teraterm.feasible-lab.com\/"},{"@type":"ListItem","position":2,"name":"5.4. \u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3092\u5165\u308c\u3088\u3046"}]},{"@type":"WebSite","@id":"https:\/\/teraterm.feasible-lab.com\/#website","url":"https:\/\/teraterm.feasible-lab.com\/","name":"\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bTera Term\u30de\u30af\u30ed","description":"Teraterm\u30de\u30af\u30ed\u3067\u65e5\u3005\u306e\u4ed5\u4e8b\u3092\u697d\u306b\u3057\u307e\u3057\u3087\u3046","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/teraterm.feasible-lab.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/teraterm.feasible-lab.com\/#\/schema\/person\/e37c225a001d2e04f83152790d000c65","name":"Shunsuke Yoshikawa","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/secure.gravatar.com\/avatar\/50ab8703b04a9ec3a59e1459091a462d3233d120549dac001854c8892741e6ee?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/50ab8703b04a9ec3a59e1459091a462d3233d120549dac001854c8892741e6ee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/50ab8703b04a9ec3a59e1459091a462d3233d120549dac001854c8892741e6ee?s=96&d=mm&r=g","caption":"Shunsuke Yoshikawa"},"url":"https:\/\/teraterm.feasible-lab.com\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=193"}],"version-history":[{"count":1,"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":370,"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=\/wp\/v2\/posts\/193\/revisions\/370"}],"wp:attachment":[{"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/teraterm.feasible-lab.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}