#!/bin/bash

echo -n "Please write an output filename (example: output.tar.gz): " 
read filename
tar -cvf $filename *.jpg *.png
rm *.jpg *.png
echo "tar successfully filename is " >> $filename

#!/bin/bash

echo -n "Please write an output filename (example: output.tar.gz): " 
read filename

echo -n "Please write the prefix for the file to be zipped (optional): "
read prefix

tar -cvf $filename "${prefix}*.jpg" "${prefix}*.png"
rm "${prefix}*.jpg" "${prefix}*.png"
echo "tar successfully filename is " >> $filename

Add prefix to make tar
Add prefix to make tar