Yes, you can't nest the substitutions as both of them require a variable name.
You may however do it in one call to basename
:
base="$( basename "$pathname" .o )-1234.o"
The second argument to basename
is a suffix that will be removed from the given string.
Also note that using uppercase PATH
as a variable in a shell script is a really bad idea, as this variable is used by the shell for finding external utilities.
Use lowercase variable names in scripts. This helps avoid clashes with shell variables and environment variables that the shell is using for other things.
zsh
and you'll be able to do whatever you want (e.g. nest, combine parameter expansion etc) – don_crissti Oct 05 '17 at 19:10