shiftdot515

all

Apr 12th, 2020
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. #!/var/bin/mksh
  2. # find all the executables in the path, that match the parameters
  3. SAVE_IFS="$IFS"
  4. for X in $@
  5. do
  6.   IFS="${IFS}:"
  7.   for P in $PATH
  8.   do  
  9.     cd "$P" || break;
  10.     if [[ -x "$X" ]];
  11.     then
  12.         print "$P/$X"
  13.     fi
  14.   done
  15.   IFS="$SAVE_IFS"
  16. done
  17. #consider storing PATH in an array, becauses of special character issues.
  18. #consider checking std path like whereis
  19. #consider allowing wildcard matches,
  20. #consider reworking to go though path , first... or alternate path
  21. #consider meh no maybenot NEATOdirectory in arg list
  22. # when all Im considering is if . is, kinda stupid to miss it.
  23. #if $P == $P ?
Add Comment
Please, Sign In to add comment