Suppose your variable is PDNS where
PDNS=" test " then to remove leading whitespaces from it try:
PDNS="${PDNS#"${PDNS%%[![:space:]]*}"}"
echo $PDNS
This will trim the leading whitespaces.
To remove trailing whitespaces from this variable try:
PDNS="${PDNS%"${PDNS##*[![:space:]]}"}"
PDNS=" test " then to remove leading whitespaces from it try:
PDNS="${PDNS#"${PDNS%%[![:space:]]*}"}"
echo $PDNS
This will trim the leading whitespaces.
To remove trailing whitespaces from this variable try:
PDNS="${PDNS%"${PDNS##*[![:space:]]}"}"
No comments:
Post a Comment