Computer Science, asked by ayhanalizadem, 5 days ago

Write a script (linux) that counts the number of files and the number of directories (in the current directory) that the user is allowed to modify. Display the results with an appropriate comment.

please helppp​

Answers

Answered by SP85
3

#!/bin/sh

if test $# -eq 0

then

startdir="$HOME"

else

startdir="$1"

fi

for f in "$start"/* # step through all files in the starting directory

do

echo "$f" # print the file name

if test -d "$f" # is the file a directory? (-d)

then

sh "$0" "$f" # yes call this script with the dir as arg

fi

done

Is it enough for you

Similar questions