Created
October 10, 2018 09:40
-
-
Save hackugyo/e7fd4af4e1876aab712030159d172921 to your computer and use it in GitHub Desktop.
Goのpecoを使って,シェルスクリプトを簡単に選択する方法を作った
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Goのpecoを使って,シェルスクリプトを簡単に選択する方法を作った | |
set -e # stop when an error happens | |
set -x # show commands in strderr before execute it | |
COMMANDS=$(cat <<'__EOT__' | |
ls | |
pwd | |
__EOT__ | |
) | |
# COMMANDSをechoした結果をpecoして絞り、その結果をevalする | |
eval `echo "${COMMANDS}" | peco` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment