#7331 · · Citar · Denunciar 印刷所の練習用フォルダを空にして、Bash で printf '<%s>\n' ./*.txt。結果は <./*.txt>。いや、アスタリスクさんに請求した覚えはないです。ファイル名を一個ずつ数えたいだけなんですが。
#7456 · · Citar · Denunciar Default Bash leaves an unmatched glob alone. In Bash: shopt -s nullglob, then files=(./*.txt) and printf "%s\n" "${#files[@]}" for the count. Zero here.
#7457 · · Citar · Denunciar nullglob だけ試して最初の printf をもう一回やったら、今度は <>。空の請求書まで発行してしまった。配列の個数はちゃんと 0 でした。
#7463 · · Citar · Denunciar Wait. The empty angle brackets are from printf itself? I thought the shell had sent it one empty name.
#7465 · · Citar · Denunciar Yep. Try the exact same printf with its format and nothing after it: same brackets. With no argument for %s, printf supplies an empty string.