Ubuntu 1804 .HEIC convert .jpg

1.install libheif-examples
sudo apt-get install libheif-examples
2.Convert subfolder *.HEIF to .jpg
for file in *.HEIC; do heif-convert $file ${file/.HEIC/.jpg}; done
將同一目錄下,所有副檔名為「.HEIC」的檔案,用 heif-convert 程式轉為同檔名,但副檔名為「 .jpg」 的 JEPG 格式圖檔。
for file in *.HEIC; do heif-convert $file ${file/%.HEIC/.jpg}; done
將同一目錄下,所有檔名結尾副檔名為「.HEIC」的檔案,用 heif-convert 程式轉為同檔名,但副檔名為「 .jpg」 的 JEPG 格式圖檔。

參考:
2.Replace one substring for another string in shell script
搜尋取代變數的字串:
#!/bin/sh
str="hello_abc"
echo ${str/abc/xyz
man bash 手冊中 ${parameter/pattern/string} 說明
${parameter/pattern/string}
${parameter/pattern/string} Pattern substitution.
The pattern is expanded to produce a pattern just as in pathname expansion. Parameter is expanded and the longest match of pattern against its value is replaced with string.
If pattern begins with /, all matches of pattern are replaced with string.
Normally only the first match is replaced.
If pattern begins with #, it must match at the beginning of the expanded value of parameter.
If pattern begins with %, it must match at the end of the expanded value of parameter.
If string is null, matches of pattern are deleted and the / following pattern may be omitted.
If parameter is @ or *, the substitution operation is applied to each positional parameter in turn, and the expansion is the resultant list.
If parameter is an array variable subscripted with @ or *, the substitution operation is applied to each member of the array in turn, and the expansion is the resultant list.
更多範例:
first="I love Suzy and Mary"
second="Sara"
first=${first/Suzy/$second}
That will replace only the first occurrence; to replace them all, double the first slash:
first="Suzy, Suzy, Suzy"
second="Sara"
first=${first//Suzy/$second}
# first is now "Sara, Sara, Sara"