Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在、次のスクリプトがあります。
var_name=`cat X | grep Y`
ここで、X と Y はファイル名と何らかの文字列です。これを一般化して、X と Y をスクリプトの第 1 引数と第 2 引数に渡したいと思います。私は試した
var_name=`cat $1 | grep $2`
と
var_name=`cat "$1" | grep "$2"`
しかし、どちらも機能しません。
これを行う正しい方法は何ですか?