Reputation: 751
deppfx@localhost:/tmp$ echo ${$(hostname): -3}
-bash: ${$(hostname): -3}: bad substitution
I am looking for the output as ost
.
Related: https://stackoverflow.com/a/19858692/598175
Upvotes: 0
Views: 180
Reputation: 1031
The substitution works in variables, not in commands.
echo $(myVar=$(hostname);echo ${myVar: -3})
Upvotes: 1
Reputation: 399
It should be ${variable: -3}
. Don't try to substitute command.
Upvotes: 2