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
Script HW/SW AIX
Viewed 9384 times since Mon, Jun 4, 2018
“Yes/No” in Bash Script – Prompt for Confirmation
Viewed 33142 times since Mon, Feb 18, 2019
How to get a password from a shell script without echoing - solutions
Viewed 14049 times since Fri, Feb 22, 2019
Time conversion using Bash
Viewed 2833 times since Fri, May 25, 2018
How to sort IP addresses in Linux
Viewed 4077 times since Thu, May 24, 2018
Linux and Unix xargs command tutorial with examples
Viewed 4008 times since Fri, Jun 1, 2018
perl podstawy
Viewed 2135 times since Mon, May 21, 2018
Tunneling With SSH to Your Destination
Viewed 4587 times since Wed, May 30, 2018
View Config Files Without Comments
Viewed 2434 times since Mon, May 21, 2018
Display basic information about Physical Volumes
Viewed 3580 times since Sun, Jun 3, 2018