diff --git a/linux-bash/loops/src/main/bash/find_directories.sh b/linux-bash/loops/src/main/bash/find_directories.sh new file mode 100755 index 0000000000..8a9b20294d --- /dev/null +++ b/linux-bash/loops/src/main/bash/find_directories.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +find . -maxdepth 1 -mindepth 1 -type d -printf '%f\n' + +find . -maxdepth 1 -mindepth 1 -type d | while read dir; do + echo "$dir" +done + +find . -maxdepth 1 -type d -exec echo {} \; \ No newline at end of file diff --git a/linux-bash/loops/src/main/bash/loop_directories.sh b/linux-bash/loops/src/main/bash/loop_directories.sh new file mode 100755 index 0000000000..77e661d710 --- /dev/null +++ b/linux-bash/loops/src/main/bash/loop_directories.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +for dir in */; do + echo "$dir" +done + +for file in *; do + if [ -d "$file" ]; then + echo "$file" + fi +done \ No newline at end of file