Code: Select all
echo {A..Z}
Code: Select all
seq 1 30
Taps
Code: Select all
echo {A..Z}
Code: Select all
seq 1 30
You're probably looking for something more elegant, but this appears to work ...Tapster wrote: Thanks in advance. Any other thoughts or command recommendations greatly apprciated.
Code: Select all
echo -e 'A\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nU\nV\nW\nX\nY\nZ'
If you plan on doing this in a script, you need a loop.
Code: Select all
#! /bin/bash
for letter in {A..Z}
do
echo ${letter}
done
Code: Select all
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
Code: Select all
printf '%s\n' {A..Z}
%s
), if you've not got enough identifiers relative to the data the formatting field formats, as in this case. It's better you experiment with it than me trying to explain the oddness of it. Here's another example:Code: Select all
$ printf 'This is a: %s.\n' test carrot bag
This is a test.
This is a carrot.
This is a bag.
Code: Select all
$ printf '%s\n' 'This is a '{test,carrot,bag}.
This is a test.
This is a carrot.
This is a bag.
Well, that's much nicer. Thank you.Termy wrote: ⤴Tue Jun 29, 2021 9:59 pm You're probably wanting this:
Code: Select all
printf '%s\n' {A..Z}
+1. Well done.Termy wrote: printf '%s\n' {A..Z}
Code: Select all
echo -e \\b{A..Z}\\n
I get an extra newline character at the end. Putting that newline character there as the suffix for the brace expansion was good thinking.
-n
to echo gets rid of that: echo -ne \\b{A..Z}\\n
.Ah, of course! Good thinking. I rarely use `echo`, so I keep forgetting it has those flags.