Usuwanie spacji z zmiennych w bash

Usuwanie początkowych / „wiodących” spacji z zmiennej:

ZMIENNA="${ZMIENNA#"${ZMIENNA%%[![:space:]]*}"}"

Usuwanie końcowych / „wleczących” spacji z zmiennej:

ZMIENNA="${ZMIENNA%"${ZMIENNA##*[![:space:]]}"}"
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
30 Examples for Awk Command in Text Processing
Viewed 15409 times since Sat, Nov 24, 2018
Epoch & Unix Timestamp Conversion Tools
Viewed 62996 times since Fri, Jun 22, 2018
Display basic information about Physical Volumes
Viewed 3532 times since Sun, Jun 3, 2018
awk printf
Viewed 15358 times since Wed, Aug 19, 2020
Linux and Unix xargs command tutorial with examples
Viewed 3961 times since Fri, Jun 1, 2018
Using Shell Redirection: All About the Here-Doc
Viewed 10496 times since Wed, May 30, 2018
10 Awk Tips, Tricks and Pitfalls
Viewed 6016 times since Wed, Aug 19, 2020
Convert a human readable date to epoch with a shell script on OpenBSD and Mac OS X
Viewed 15245 times since Fri, May 25, 2018
HowTo: Clear BASH History
Viewed 2240 times since Mon, Feb 18, 2019
Linux / UNIX: Convert Epoch Seconds To the Current Time
Viewed 3122 times since Fri, May 25, 2018