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...

The & operator is called the _______________

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

After you install the ________ app on your mobile phone, you can attach videos of six seconds or less to your mobile tweets

Fill in the blank(s) with correct word

Computer Science & Information Technology

On a slide, a(n) ________ is the space between the placeholder margin and the text

A) indent B) tab C) margin D) hanging indent

Computer Science & Information Technology

You can configure sharing options for which network profiles?

a. Home or Work and Public b. Home or Work only c. Public only d. Private

Computer Science & Information Technology