Answer the question
In order to leave comments, you need to log in
What are operations with a string in a variable like "${var//./}" called, and where can I find more information about these possibilities?
In writing scripts, I often use similar things that I once saw in other people's scripts and I know about them no more than that this works.
Let's say we have a variable:
With its contents, you can perform similar manipulations:foo='1.2.3.4.5'
echo ${foo/./} # 12.3.4.5
echo ${foo//./} # 12345
echo ${foo%.*} # 1.2.3.4
echo ${foo%%.*} # 1
echo ${foo#*.} # 2.3.4.5
echo ${foo##*.} # 5
Answer the question
In order to leave comments, you need to log in
Source: - Advanced Bash-Scripting Guide (Chapter 10. Manipulating Variables)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question