How to extract the last N characters from a string in Bash

1 Answer

0 votes
s="bash Unix shell and command language"

N=5  
lastCharacters=${s: -N}
 
echo $lastCharacters
  
  
  
  
# run:
#
# guage
#

 



answered Feb 7, 2021 by avibootz

Related questions

1 answer 246 views
1 answer 198 views
1 answer 220 views
2 answers 272 views
2 answers 567 views
2 answers 346 views
1 answer 232 views
232 views asked May 28, 2021 by avibootz
...