Created
November 9, 2020 09:45
-
-
Save tajnymag/6226775f9c942c375635b6d84933648c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# nums : script vypise pocet souboru a adresaru | |
if [ $# -eq 0 ]; then | |
set -- "." | |
fi | |
for dir in $*; do | |
if [ ! -d "$dir" ]; then | |
echo "$0 : $dir neni adresar" | |
else | |
echo "$dir :" | |
fcount=0 | |
flcount=0 | |
dcount=0 | |
dlcount=0 | |
for file in $(find "$dir" -maxdepth 1 2>/dev/null); do | |
if [ -f "$file" -a ! -L "$file" ]; then | |
fcount=$(expr $fcount + 1) | |
elif [ -f "$file" -a -L "$file" ]; then | |
flcount=$(expr $flcount + 1) | |
elif [ -d "$file" -a ! -L "$file" ]; then | |
dcount=$(expr $dcount + 1) | |
elif [ -d "$file" -a -L "$file" ]; then | |
dlcount=$(expr $dlcount + 1) | |
fi | |
done | |
echo "$dcount adresaru $fcount obyčejných souborů $dlcount symbolických linků na adresáře $flcount symbolických linků na obyčejné soubory" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment