Hi new to the forums looking for some help with some Linux scripting.
:wall::wall::wall:
currently working on a script that calculates user information, and i am trying to find out how i would go about getting the amount of regular files, the amount of hidden files, the amount of regular directories, the amount of hidden directories, and the amount of other types of files(AKA links).
I�ve already managed to figure out how many normal files i have using a function that uses the out put of a variable.
this is the code i used
##this is the variable
files=$(ls -a $HOME)
##this is the function
filesfunc(){
files=$#
for hidden in $#
do
if [ "$hidden" = "." ]
then
$hidden=$(expr $hidden - $files)
fi
done
echo -e "Contains:\t$files regular file(s), and $hidden hidden"
}
##calling it like so
filesfunc $files
that code will get me the correct amount of files but it just shows me the same for hidden.
the output i am looking for is
contains: ## regular files, and ## hidden
## directories, and ## hidden
## other types of files.
yah i am still pretty fresh to linux scripting. thanks for your help tho i really appreciated it
the output that i want is all the files in home and then all that are hidden
so regular files is basicly total files and the hidden are just the hidden files from the total