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 248 views
2 answers 284 views
1 answer 214 views
1 answer 195 views
2 answers 313 views
2 answers 278 views
1 answer 251 views
...