Skip to content

Commit b73c849

Browse files
committed
added functions folder
1 parent eea96f3 commit b73c849

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /bin/bash
2+
#count files in a given dir
3+
4+
function file_count() {
5+
local lines="$(ls -l "$1" | wc -l)"
6+
echo "$1 : $((lines - 1))"
7+
}
8+
9+
read -p "Give a dir path to count files in it: " DIRPATH
10+
file_count "${DIRPATH}"

0 commit comments

Comments
 (0)