A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

January 15, 2012

trouble with name increment


I am trying to write a script that records a window on my screen. No pb with that.
To go further I would like to choose an incremental fileName for output incrementing if the fileName already exist.
I have trouble doing it so before dealing with the incrementation itself, I want to check I can substitute the calculated name in the ffmpeg command.


index=1 #I will deal with the incrementation of index after this part works

mystring="${fileName}${index}.mkv" #omce I have a proper index I concatenate the name with index and name extension

echo ${mystring} # gives ~/Bureau/essai1.mkv seems to be what I expect

ffmpeg -f alsa ..... -y ${mystring}

I get this message

~/Bureau/essai1.mkv No such file or directory

despite -y to force overwriting

However if I put the file name directly in the command like this

ffmpeg -f alsa ..... -y ~/Bureau/essai1.mkv

it works perfectly. My question is : "What is wrong ?"

Click Here!