Search code examples
bashcommand-line-interfacevlctimedelay

How do I tell VLC to start to play a file at a certain point in time when that time is a variable?


I am trying to invoke vlc --start-time=$x filename.mp3 but the file begins to play from the beginning.

I use

    echo "give me the time"
    read x

to assign a value to $x. Then I subtract 3 to start playing the file a bit earlier than that.

I wonder if $x needs to have a specific format. I tried

    ((x=$x-3))

and also

    x=`echo $x-3|bc -l` 

and also several variations of "" '' `` () around $x e.g. like so

    vlc --start-time="$x" filename
    vlc '--start-time="$x"' filename

but none of that works. Does anyone know what I am doing wrong?

Thanks a lot!


Solution

  • Try this, I hope it helps

     "vlc --start-time=$(($x-3)) filename"