kubech icon indicating copy to clipboard operation
kubech copied to clipboard

find: -printf: unknown primary or operator

Open ibexmonj opened this issue 3 years ago • 4 comments

Firstly, thank you for writing this and making this widely available. This is a boon for managing multiple clusters.

The installation steps as described in the documentation worked just fine.

I can use kubech just fine and kubechc lets we switch the clusters just fine as well. Everytime i switch context in a new terminal i see the below message.

find: -printf: unknown primary or operator
find: -printf: unknown primary or operator

My workstation is Intel Mac OS.

Not sure about the cause of this and if its a me problem. Have you run into this by any chance ?

ibexmonj avatar Jun 24 '22 14:06 ibexmonj

haven't had a chance to dig deep into patching this in a way that'll work on linux but on mac brew install findutils and patch kubech with the following

index d5a918c..d26eb61 100644
--- a/kubech
+++ b/kubech
@@ -54,7 +54,7 @@ chmod 744 "${KUBECONFIG_SRC_DIR}" "${KUBECONFIG_DEST_DIR}"
 # Handeling Kube config files.
 _kubeconfig_files () {
     if [ -d "${KUBECONFIG_SRC_DIR}" ]; then
-        KUBECONFIG_FILES="$(find "${KUBECONFIG_SRC_DIR}" -type f -printf '%p:')"
+        KUBECONFIG_FILES="$(gfind "${KUBECONFIG_SRC_DIR}" -type f -printf '%p:')"
     fi
     echo "${KUBECONFIG_FILES}${KUBECONFIG_ORIG}"
 }```

due to the following
https://unix.stackexchange.com/questions/272491/bash-error-find-printf-unknown-primary-or-operator

chrisdotm avatar Jun 24 '22 15:06 chrisdotm

Ah, looks like macOS doesn't have GNU find.

Do you have the printf command? It would be easy to use it with ls to get the same results.

aabouzaid avatar Jun 25 '22 19:06 aabouzaid

You can also

brew install findutils

And add this to your shell RC file

alias find=gfind

To not have to patch kubech. That will globally replace macOS' default /usr/bin/find with gfind.

rklingsberg avatar Aug 09 '22 16:08 rklingsberg

that would potentially cause issue with things expecting BSD find on your system

chrisdotm avatar Aug 22 '22 11:08 chrisdotm

fixed by #8

aabouzaid avatar Dec 14 '22 12:12 aabouzaid