help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Change filename extension in Bash array


From: Jeffrey Walton
Subject: Change filename extension in Bash array
Date: Mon, 25 Jan 2021 04:41:56 -0500

Hi Everyone,

Search is not turning up the results I am looking for. I would appreciate help.

I have an array with filenames:

    odt_files=("ch1.odt" "ch2.odt" "ch3.odt" ...)

I convert the ODT to a PDF using lowriter, which is a LibreOffice utility.

I need to combine the PDFs using pdfunite for the final document.

How do I create an array of filenames using the PDF extension given
the ODT extension in odt_files?

    # What is needed here?
    pdf_files=${odt_files}

Here are some things I know do not work:

    pdf_files=("${odt_files[@]/.odt/.pdf}")
    pdf_files=("${odt_files/.odt/.pdf}")
    pdf_files="${odt_files[@]/.odt/.pdf}"
    pdf_files="${odt_files/.odt/.pdf}"

Thanks in advance

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]