+#! /bin/bash
+
+print_help() {
+echo "Usage: $(basename $0) INPUT... -o OUTPUT"
+echo " or: $(basename $0) INPUT... 3> OUTPUT"
+echo "Merge INPUT(s) videos to single OUTPUT"
+}
+
+inputs=()
+while [ "$#" -gt 0 ]; do
+ case $1 in
+ -h | --help)
+ print_help
+ exit 0
+ ;;
+ -o | --output)
+ if [ "$2" != ' ' ]
+ then
+ output=$2
+ else
+ echo "$(basename $0): No output file after '-o'" >&2
+ echo "Try '$(basename $0) --help' for more information." >&2
+ exit -1
+ fi
+ shift; shift
+ ;;
+ -i | --interactive)
+ interactive="true"
+ shift
+ ;;
+ *)
+ inputs=( "${inputs[@]}" "$1" )
+ shift
+ ;;
+ esac
+done
+
+while [ $interactive ]
+do
+ echo $interactive
+ echo "$(basename $0): merging '${inputs[@]}' to '${output}'"
+ echo "Do you want to continue? [Y/n] "
+ read ans
+ case $ans in
+ n | no)
+ exit 1
+ ;;
+ y | yes | '')
+ echo "yes"
+ unset interactive
+ ;;
+ esac
+done
+
+if [ -n "$output" ]
+then
+ mencoder -forceidx -ovc copy -oac copy "${inputs[@]}" -o "$output"
+# mv "${inputs[@]}" /mnt/Skaro/ffmerge.backup/
+else
+ echo "$(basename $0): No output arguments" >&2
+ echo "Try '$(basename $0) --help' for more information." >&2
+fi