I am trying to pass an array as an input for a different bash file. The main file is:
#!/bin/bash
arr=( "$@" )
path=`pwd`
cd ${arr[0]}
    read -p "Enter number of videous: " number_of_videous   
    for ((i=0;i<number_of_videous;i++))
    do
        read -p "Enter the resolution: " resolution
        
        if [ $resolution -eq 1080 ]
        then
            mkdir "${arr[1]}_1080_directory"
            ffmpeg -i ${arr[1]} -vf scale=1920:1080 -preset slow -crf 18 "${arr[1]}_1080_directory/output.mp4"
            arr=("${arr[1]}_1080_directory/output.mp4" "$resolution")
            sh "$path"/check_resolution_video.sh "${arr[@]}"
            .~/Script/bitrate.sh "${arr[1]}_1080_directory" "output.mp4"
            
        elif [ $resolution -eq 720 ]
            then
                mkdir "${arr[1]}_720_directory"
                ffmpeg -i ${arr[1]} -vf scale=1280:720 -preset slow -crf 18 "${arr[1]}_720_directory/output.mp4"
                arr=("${arr[1]}_720_directory/output.mp4" "$resolution")
                .~/Script/check_resolution_video.sh "${arr[@]}"     
                .~/Script/check_resolution_video.sh "${arr[@]}"
                .~/Script/bitrate.sh "${arr[1]}_720_directory" "output.mp4"
        fi      
    done
And the file that must be called and pass variables is:
#!/bin/bash
echo `pwd`
echo "$@"
arr=("$@")
resolution=`ffprobe -v error -select_streams v -show_entries stream=width,height -of csv=p=0:s=x "${arr[0]}"`
if [ ${arr[1]} -eq 1080 ] ; then    
    if [ $resolution == '1920x1080' ] ; then
        echo "The video: ${arr[1]} is true"
 
    fi
elif [ ${arr[1]} -eq 720 ] ; then       
    if [ $resolution == '1280x720' ]
    then
        echo "The video: ${arr[1]} is true"
    fi
fi
Everything is working until the "arr=("$@")" of the second file. Is not a permission issue.
The error is: "/home/alex/Script/check_resolution_video.sh: 7: Syntax error: "(" unexpected".
Moreover, the script receive the right parameters because I echo them first.
Do you have any idea what should I do in this situation?