So I'm trying to run this command to turn files into a .chd file:
for i in *.cue; do chdman createcd -i "$i" -o "${i%.*}.chd"; done
But I get this error:
fish: ${ is not a valid variable in fish.
for i in *.cue; do chdman createcd -i "$i" -o "${i%.*}.chd"; done
Which is boggling to me cuz I run this command to convert flac to ogg and it works just fine:
find . -name "*flac" -exec sh -c 'oggenc -q 7 "$1" -o ~/vorbis/"${1%.*}".ogg' _ {} \;
The second line uses ${ and works fine. So why is the first command giving me that error for ${? I've searched around and can't find much on the subject. I'd really like to understand so if I use a similar string in the future I'll know what to do. I don't really know much about coding, so this really has my interest. And frustration at the same time.
What I have tried is replacing ${ with $(, and other variants. But nothing has worked. The command works fine in zsh, so it's something with Fish.
I did find this
Looks like someone having a similar problem, but... do I really have to install something (ghc) to get this working? Seems like there would be a different work around.
Your second working command is running commands in a Bourne shell (
/bin/sh); that's what the-exec sh -c '...'is for in yourfindcommand.On the other hand, you're trying to run the first command directly in the
fishshell. That's not going to work. You could explicitly run it using/bin/sh, just like in yourfindcommand: