[GTALUG] Bash Problem

Mauro Souza thoriumbr at gmail.com
Sun Jan 8 10:28:03 EST 2017


Or
nFname="${base}.mp4"

Using brackets you can mix variables and text and create something like
this:
newName="${oldname}-bkp-${filedate}.${extension}.old"

Mauro
http://mauro.limeiratem.com - registered Linux User: 294521
Scripture is both history, and a love letter from God.

2017-01-08 13:21 GMT-02:00 William Park via talk <talk at gtalug.org>:

> On the topic of quotes, see my in-line comments...
>
> On Sun, Jan 08, 2017 at 05:57:40AM -0500, Stephen via talk wrote:
> > On 2017-01-07 07:25 PM, Stephen via talk wrote:
> > > #!/bin/bash
> > > # Usage: convert file to mp4
> > > shopt -s nullglob
> > > ext='.mp4'
> > > for f in *.mkv
> > > do
> > >    base=$(basename $f .mkv)
>
> Should be
>     base=$(basename "$f" .mkv)
>
> > >    nFname=$base".mp4"
>
>     nFname="$base".mp4
>
> > >    echo $nFname
> > >    avconv "-i $f -c:v libx264 -c:a copy $nFname"
>
>     avconv -i "$f" -c:v libx264 -c:a copy "$nFname"
>
> > > done
> >
> >
> > Thank you for the replies. Simply removing the quotes did the trick! :)
> ---
> Talk Mailing List
> talk at gtalug.org
> https://gtalug.org/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20170108/f7715415/attachment.html>


More information about the talk mailing list