Finding the directories with same permission and then apply some default UNIX commands

view full story

http://www.unix.com – Write a Unix shell script named 'mode' that accepts two or more arguments, a file mode, a command and an optional list of parameters and performs the given command with the optional parameters on all files with that given mode. For example, mode 644 ls -l should perform the command ls -l on all files in the current directory that have mode 644. I came up with this code. how can I ask the code to apply the rest of arguments in the command line to the result of the script? Code: #!/bin/sh mode=$1 shift 1 ls -l |awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \   &nb (HowTos)