Freewind
Freewind

Reputation: 198358

How to output the variable value with other letters together with fishshell?

I want to write a fish shell to change the speed of an audio file.

The shell name is speed, I can call it like this:

speed 1.mp3 0.7

Then I will get a new file [0.7x] 1.mp3 with changed speed.

But I have a problem with the destination file name:

speed

#!/usr/local/bin/fish

set source $argv[1]
set ratio $argv[2]

ffmpeg -i $source -filter:a "atempo=$ratio"  "[{$ratio}x] $source"

It will output a new file [{0.7}x] 1.mp3, which contains unnecessary {}. But if I remove it as the "[$ratiox] $source", the $ratiox is not correct too.

How to fix it?

Upvotes: 1

Views: 287

Answers (1)

ridiculous_fish
ridiculous_fish

Reputation: 18561

The simplest is to exit the quotes:

ffmpeg -i $source -filter:a "atempo=$ratio" "["$ratio"x] $source"

Upvotes: 4

Related Questions