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 386 views
1 answer 319 views
1 answer 333 views
2 answers 405 views
2 answers 736 views
2 answers 493 views
1 answer 360 views
360 views asked May 28, 2021 by avibootz
...