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.
Bash が部分文字列内の単語を分割しないようにするにはどうすればよいですか? 問題を説明するために、やや不自然な例を次に示します。
touch file1 'foo bar' FILES="file1 'foo bar'" ls -la $FILES
$FILES 内の ls コマンドによって単一の文字列と見なされる 'foo bar' を取得することは可能ですか?これにより、実質的に次のコマンドと同じ動作が得られますか?
ls -la file1 'foo bar'
配列を使用します。
files=( file1 'foo bar' ) ls -la "${files[@]}"