I was using a method that jumped through hoops using some printf nonsense in order to put the result of the brace expansion into an array, I removed it from the answer because list=( {' '..~} ), as in ilkkachu's answer would Just Work; this is an alternative (worse) method.
If I understood correctly:
for c in {' '..~}; do list+=($c); done Some notes:
- There's no need to quote
~in the brace expansion; - Technically what's printed and stored is just a subset of ASCII (it excludes non-printable characters).
% for c in {' '..~}; do list+=($c); done % printf '%d\n' ${#list[@]} 95 % printf '%c' "${list[1]}" | xxd 00000000: 20 % printf '%c' "${list[2]}" | xxd 00000000: 21 ! % printf '%c' "${list[3]}" | xxd 00000000: 22 % print ${list} " % print ${list} ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~