{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1908-powershell-alias-grep" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## overview" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- powershellのaliasをgrepする" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## environment" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "$PSVersionTable" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## reference" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Out-Stringを使ってSelect-Stringをより便利に使う \n", " + https://blog.shibata.tech/entry/2015/08/23/235304" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## log" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "$PSVersionTable\n", "\n", "Name Value \n", "---- ----- \n", "PSVersion 5.1.17134.765 \n", "PSEdition Desktop \n", "PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} \n", "BuildVersion 10.0.17134.765 \n", "CLRVersion 4.0.30319.42000 \n", "WSManStackVersion 3.0 \n", "PSRemotingProtocolVersion 2.3 \n", "SerializationVersion 1.1.0.1 \n", "\n", "\n", "get-alias | out-string -stream | select-string \"new-item\"\n" ] } ], "source": [ "get-alias | out-string -stream | select-string \"new-item\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Alias ni -> New-Item \n", "\n", "\n", "get-alias | out-string -stream | select-string \"Out\"\n" ] } ], "source": [ "get-alias | out-string -stream | select-string \"Out\"" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Alias echo -> Write-Output \n", "Alias lp -> Out-Printer \n", "Alias ogv -> Out-GridView \n", "Alias oh -> Out-Host \n", "Alias write -> Write-Output \n", "\n", "\n", "get-alias | out-string -stream | select-string \"get-alias\"\n" ] } ], "source": [ "get-alias | out-string -stream | select-string \"get-alias\"" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Alias gal -> Get-Alias \n", "\n", "\n", "gal | out-string -stream | sls 'sls'\n" ] } ], "source": [ "gal | out-string -stream | sls 'sls'" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Alias sls -> Select-String \n", "\n", "\n", "gal | oss | sls 'dir'\n", "\n", "Alias chdir -> Set-Location \n" ] } ], "source": [ "gal | oss | sls 'dir'" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "PowerShell", "language": "powershell", "name": "powershell" }, "language_info": { "codemirror_mode": "shell", "file_extension": ".ps1", "mimetype": "text/x-sh", "name": "powershell" } }, "nbformat": 4, "nbformat_minor": 2 }