linux迭代目录中的文件

Maw*_*ter 2 linux iteration bash scripting

我正在尝试迭代目录中的每个文件.到目前为止,这是我的代码.

while read inputline
do
  input="$inputline"
  echo "you entered $input";

if [ -d "${input}" ]
  then
    echo "Good Job, it's a directory!"

    for d in $input
      do
        echo "This is $d in directory."
      done
   exit
Run Code Online (Sandbox Code Playgroud)

我的输出总是只有一行

this is $input directory.
Run Code Online (Sandbox Code Playgroud)

为什么这段代码不起作用?我究竟做错了什么?

凉.当我回声它打印出来

$input/file
Run Code Online (Sandbox Code Playgroud)

为什么这样做?它不应该打印出没有目录前缀的文件吗?