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
Display basic information about Physical Volumes
Viewed 4591 times since Sun, Jun 3, 2018
Bash: String Length – How To Find Out
Viewed 3244 times since Mon, Feb 18, 2019
Using Shell Redirection: All About the Here-Doc
Viewed 11682 times since Wed, May 30, 2018
Epoch & Unix Timestamp Conversion Tools
Viewed 87547 times since Fri, Jun 22, 2018
8 Practical Examples of Linux Xargs Command for Beginners
Viewed 6887 times since Fri, Jun 1, 2018
Linux / UNIX: Convert Epoch Seconds To the Current Time
Viewed 4025 times since Fri, May 25, 2018
Bash: Read File Line By Line – While Read Line Loop
Viewed 3391 times since Mon, Feb 18, 2019
Transform XML to CSV Format | Unix String Pattern Manipulation The Ugly Way
Viewed 8568 times since Sun, Jan 9, 2022
perl podstawy
Viewed 2695 times since Mon, May 21, 2018
How to get a password from a shell script without echoing - solutions
Viewed 16201 times since Fri, Feb 22, 2019