#!/bin/bash CAM=/base/axi/pcie@120000/rp1/i2c@80000/imx335@1a CAM=1 generate_filename() { echo "${1}_${2}.jpg" } unique_filename() { local counter=0 # Check if the file exists and increment the counter until a unique filename is found while [ -f $(generate_filename $1 $counter) ]; do ((counter++)) done echo $(generate_filename $1 $counter) } if [ $# -eq 1 ]; then filename=$(unique_filename imx335_alsc_${1}) echo "Capturing ALSC image at $1 to $filename" rpicam-still --qt-preview --camera $CAM -r -o $filename elif [ $# -gt 1 ]; then filename=$(unique_filename imx335_${1}_${2}) echo "Capturing for AWB at $1 / $2 to $filename" rpicam-still --qt-preview --camera $CAM -r -o $filename $3 $4 else echo "$0: Invalid number of arguments. Provide either one or two arguments." fi