常に 1 つのコマンドを別のコマンドにパイプします。

常に 1 つのコマンドを別のコマンドにパイプします。

次の方法は?

コマンドが次の場合

git show ..... 

その後実行

git show ..... | bat -l rs

私は、| bat -l rs実行する前にコマンドの最後に追加することを意味します。

ベストアンサー1

#!/bin/bash

case "$1" in
   show) git "$@" | bat -l rs ;;
   *) git "$@" ;;
esac

次に、このスクリプトのエイリアスをgitgit show\git

または、シェル関数を定義し、を使用してcommandシェルrcファイルに追加します(bash-syntax)。

git() {
case "$1" in
   show) command git "$@" | bat -l rs ;;
   *) command git "$@" ;;
esac
}

おすすめ記事