Thread: Rename output file from script?
below script uses handbrake cli convert videos mp4 container can play across devices.
currently, output ends being very, long because keeps old extension , have have output file add onto it.
how can modify basic script take $file injected , output less full $full?code:#!/bin/bash # handbrake processing script "convert.sh" file in /mnt/storage2/videos/convert.pending/* # 6 channel passthrough only; android devices cannot hardware decode handbrakecli -i "$file" -o "$file".hb.mp4 -f mp4 -4 -o --strict-anamorphic -m -e x264 -q 19 -a 1 -e copy:ac3 -6 6ch -b 640 --verbose=1 #move original mv $file /mnt/storage2/converting/processed/ #move new mv $file.hb.mp4 /mnt/storage2/videos/movies/
i'd take first part before "." extension, keep it, , use in output plus new extension.
input appreciated!
you can use bash % , %% parameter substitutions remove shortest matching suffix or longest matching suffix respectively
code:file="long file.with.lots.of.extensions"; echo "${file%.*}" long file.with.lots.ofto grab *just* extension can use corresponding # or ## snip shortest or longest prefixcode:$ file="long file.with.lots.of.extensions"; echo "${file%%.*}" long file
hope helpscode:$ file="long file.with.lots.of.extensions"; echo "${file##*.}" extensions
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Rename output file from script?
Ubuntu
Comments
Post a Comment