How to trim whitespace of a string in Bash

1 Answer

0 votes
s="    bash is a unix shell and command language       "
 
echo $s | xargs

 
 
 
# run:
#
# bash is a unix shell and command language
#

 



answered Jun 6, 2021 by avibootz

Related questions

1 answer 243 views
1 answer 228 views
3 answers 310 views
2 answers 587 views
2 answers 362 views
1 answer 259 views
1 answer 215 views
...