How to remove the first and last character of a string in Bash

1 Answer

0 votes
s="bash Unix shell and command language"
 
s="${s:1:-1}"

echo $s
 
 
 
 
# run:
#
# ash Unix shell and command languag
#

 



answered Feb 6, 2021 by avibootz

Related questions

1 answer 261 views
2 answers 300 views
1 answer 235 views
1 answer 216 views
2 answers 337 views
2 answers 299 views
1 answer 266 views
...