string substitution
just look into the following code...
Code:
#!/bin/sh the code is supposed to move all files with first extension(2nd arg) to the 2nd extension(3rd arg). Wht's wrong in the code ?? |
Please explain the following line:
Code:
filename=${file%%'${from_ext}'} |
BTW: there is also the command rename, which can rename files based on a pattern.
|
BTW you don't need any of the { } around variable names except for the outermost in ${file%%'${from_ext}'}.
Grail's question will lead to a solution. |
I don't like string substitution syntax, it looks obscure, instead I would use basename in this way:
Code:
mv "$i" "$(basename "$i" .avi).mkv" Now, of course, I don't use this to batch rename things, I use rename. Instead I use this when converting formats with ffmpeg. |
Quote:
|
Did you test this expression on the command line and got the desired result?
|
nop...i am confused..
|
Quote:
|
Ahhhh ... crts with the spoiler :)
|
It wasn't a total spoiler ...
... I merely gave a hint and which will also help the OP with the other problematic lines.
I'm just saying: whitespace So there is still plenty of fun left for the OP :) |
Nice work as always crts ;)
|
All times are GMT -5. The time now is 05:16 PM. |