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.
my_grep スクリプトがあります
#!/bin/csh cat $1 | grep -i -E " a | b "
どうして
cat a* | grep -i -E " a | b " > out1.txt
と
my_grep a* > out2.txt
異なる結果をもたらす?
a*シェルスクリプトに行く前にシェルで展開します。したがって、スクリプトによって処理される でmy_grep a*始まる最初のファイルのみが提供aされます。一方、 でcat a*始まるすべてのファイルで機能しますa*。スクリプトを に変更するcat $*と、目的の結果が得られます。
a*
my_grep a*
a
cat a*
cat $*