end_date=$(date +'%Y-%m-%d') offset=28 project_dir="Bagamoyo_trial" # Parse command line arguments for arg in "$@"; do case $arg in --end_date=*) end_date="${arg#*=}" ;; --offset=*) offset="${arg#*=}" ;; --project_dir=*) project_dir="${arg#*=}" ;; *) echo "Unknown option: $arg" exit 1 ;; esac shift done echo "end_date: $end_date" echo "offset: $offset" # Check if required arguments are set if [ -z "$end_date" ] || [ -z "$project_dir" ] || [ -z "$offset" ]; then echo "Missing arguments. Use: ci_extraction.sh --end_date=2024-01-01 --offset=28 --project_dir=Bagamoyo_trial" exit 1 fi echo ci_extraction.R $end_date $offset $project_dir cd ../r_app Rscript 20_ci_extraction.R $end_date $offset $project_dir