あるディレクトリのコンテンツを別のディレクトリにコピーする以下の 2 つのプログラムの違いは何ですか?

あるディレクトリのコンテンツを別のディレクトリにコピーする以下の 2 つのプログラムの違いは何ですか?

プログラム番号1(エラー発生)

#!/bin/bash

echo "Enter source and destination directories: "
read $src $dest

if  [ -d $src ]  &&  [ -d $dest ]
then 
  echo "Process will start "
 else 
   echo "Enter valid directories"
   exit 1
 fi

 cp -r $src $dest

 status=$?

 if  [ $? -eq 0 ]
 then 
   echo "Successfully completed "

  else 
    echo "facing some problems "
fi 

2 番目のプログラム (実行時にエラーは発生しません)

#!/bin/bash

echo "Enter Sourse Directory name : "

read src

echo "Enter destination directory: "

read dest

 if [ ! -d $src ]
    then 
    echo "Enter Valid Directory name "
    exit 1
elif [ ! -d $dest ]
     then
     echo "Enter Valid Destination source name "
      exit 2
fi 

cp -r $src $dest 

status=$?

if [ $status -eq 0 ]
then 
echo "File copied succesfully"
else 
echo "there is a problem"
fi

答え1

大きな違いの 1 つは、目の下にあります。

プログラム1:

read $src $dest

プログラム2:

read src
[...]
read dst

readシェルの組み込みコマンドです(マニュアルページ)指定された変数名はない始める$

関連情報