I am executing the following commands over ssh and then past it to kubectl exec.
ssh -i 'path\to\file' user@host 'kubectl exec -i pod-name -- bash -c "du --max-depth=1 /home -h -t 10M | sort -hr > users.txt ; for i in `cat users.txt` ; do echo $i ; ls -lrtah $i ; done"' I am trying to display all user directories under /home with more than 10M in size and then redirect the output to users.txt then pass it to a for loop to display all the files inside each directory but Instead, I get an error:
cat: users.txt: No such file or directory
But when I ran the command without the for loop, it displayed the directories.
ssh -i 'path\to\file' user@host 'kubectl exec -i pod-name -- bash -c "du --max-depth=1 /home -h -t 10M | sort -hr
kubectlruns. Can you take it from here?path\to\fileindicate that the local OS is Windows? It probably does not matter, but please be specific. The remote OS looks like Linux/Unix. Is this right?