Skip to main content
added 40 characters in body
Source Link
kos
  • 4.3k
  • 1
  • 15
  • 28

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 { | } ~ 

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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 

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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 
added 55 characters in body
Source Link
kos
  • 4.3k
  • 1
  • 15
  • 28

I was jumping thoughusing 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 causefrom the answer because list=( {' '..~} ), as in ilkkachu's answer would Just Work; this is an alternative (worseworse) method.


If I understood correctly:

for c in {' '..~}; do list+=($c); done 

Some notes:

  • There's no need to quote ~ in the brace expansionexpansion;
  • 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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 

I was jumping though hoops using some printf nonsense in order to put the result of the brace expansion into an array, I removed it cause 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 
  • 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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 

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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 
added 301 characters in body
Source Link
kos
  • 4.3k
  • 1
  • 15
  • 28

I was jumping though hoops using some printf nonsense in order to put the result of the brace expansion into an array, I removed it cause 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 
  • 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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 
  1. There's no need to quote ~ in the brace expansion
  2. Technically what's printed and stored is just a subset of ASCII (it excludes non-printable characters)

If I understood correctly:

for c in {' '..~}; do list+=($c); done 
% 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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 
  1. There's no need to quote ~ in the brace expansion
  2. Technically what's printed and stored is just a subset of ASCII (it excludes non-printable characters)

I was jumping though hoops using some printf nonsense in order to put the result of the brace expansion into an array, I removed it cause 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 
  • 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} ! " # $ % & ' ( ) * + , - . / 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 { | } ~ 
Source Link
kos
  • 4.3k
  • 1
  • 15
  • 28
Loading