Modify the function you wrote for exercise 20 to descend all subdirectories of the named directory recursively and to find the maximum length of any filename in that hierarchy.

What will be an ideal response?

$ function maxfn2 () {
> declare -i max thisone
> argone=$1
>
> if [ ! -d "$argone" -o $# = 0 ]
> then
> echo "Usage: maxfn2 dirname"
> return 1
> fi
>
> max=0
> for fn in $(find $argone -print | xargs --max-args=1 basename)
> do
> thisone=${#fn}
> if [ $thisone -gt $max ]
> then
> max=$thisone
> fi
> done
> echo "Longest filename is $max characters."
> }

Computer Science & Information Technology

You might also like to view...

Users have the ability to export records in a Form View to PDF

Indicate whether the statement is true or false

Computer Science & Information Technology

You can create a navigation form in ________ or in Layout view

A) Design view B) Form view C) Object view D) Table view

Computer Science & Information Technology