mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
14 lines
218 B
Bash
14 lines
218 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
#iterate through all the files in a directory
|
||
|
for file in /home/tiandi/test/*
|
||
|
do
|
||
|
if [ -d "$file" ]
|
||
|
then
|
||
|
echo "$file is a directory"
|
||
|
elif [ -f "$file" ]
|
||
|
then
|
||
|
echo "$file is a file"
|
||
|
fi
|
||
|
done
|