Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Say I have the following
$f1=/some/path $f2=/some/subpath $f3=/some/other/subpath
If I try:
test1=${$f1/$f2/${f3:t}}
zsh complains with bad substitution.
bad substitution
However:
test2=${f3:t}
works well. What am I doing wrong?
${file:t:r}
file
The problem is with the extra $ in front of f1. Try:
$
f1
test1=${f1/$f2/${f3:t}}
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
${file:t:r}is how to combine modifiers in parameter expansions.${file:t:r}removes the path and removes the extension fromfile.