I have a Bash variable, $word
, which is sometimes a word or sentence, e.g.:
word="tiger"
Or:
word="This is a sentence."
How can I make a new Bash variable which is equal to only the first letter found in the variable? E.g., the above would be:
echo $firstletter
t
Or:
echo $firstletter
T
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…