We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eea96f3 commit b73c849Copy full SHA for b73c849
linux_training_academy/functions/script.sh
@@ -0,0 +1,9 @@
1
+#! /bin/bash
2
+#count files in pwd
3
+
4
+function file_count() {
5
+ lines="$(ls -l "$1" | wc -l)"
6
+ echo "$((lines - 1))"
7
+}
8
9
+file_count "$(pwd)"
linux_training_academy/functions/script2.sh
@@ -0,0 +1,10 @@
+#count files in a given dir
+ local lines="$(ls -l "$1" | wc -l)"
+ echo "$1 : $((lines - 1))"
+read -p "Give a dir path to count files in it: " DIRPATH
10
+file_count "${DIRPATH}"
0 commit comments