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.
jsawkによって生成された次の文字列が与えられます:
[123,456,789]
これをBASHで配列に変換する慣用的な方法はありますか?
角かっこIFSを取り除き、配列にread.
IFS
read
foo="[123,456,789]" IFS=, read -a list <<< "${foo:1:-1}"
これは、カンマ区切りの文字列に対応します。
句読点をスペースに変換するだけです。
string='[123,456,789]' array=(${string//[^0-9]/ })