#!/bin/bash    # Declare array  declare -a ARRAY  # Link filedescriptor 10 with stdin  exec 10<&0   # stdin replaced with a file supplied as a first argument   exec < $1   let count=0    while read LINE; do         ARRAY[$count]=$LINE      ((count++))  done  echo Number of elements: ${#ARRAY[@]}  # echo array's content   echo ${ARRAY[@]}   # restore stdin from filedescriptor 10   # and close filedescriptor 10   exec 0<&10 10<&-  What do lines 5 (exec 10<&0) and 7 (exec < $1) do?  
Please elaborate the following script(5,7 lines)
bash;shell script
The comments on line 4 and 6 say it all. The standard input is (arbitrarily) assigned to file descriptor 10, then the content of the file which' name was given as the first argument is assigned to stdin.   At the end of the file this is undone.It might be that the developer of the script thought that this would prevent invocation of the following form: echo -e '5\n6' | yourscript(without argument) would prevent the script from reading from stdin, but it doesn't (i.e. output is:yourscript: line 7: $1: ambiguous redirectNumber of elements: 25 6