0

Here my shell script in my host.

#!/bin/bash
loginCommend="kubectl -n my-namespace exec -it my-demo-app-58df8dc87-568gb /bin/bash"
eval "$loginCommend"
ls -la

My shell script is stop after eval "$loginCommend".

Which mean shell script is stop after changing/ssh to another host, I think. I would like to do continuous running ls -la.

Zaw Than oo
  • 9,651
  • 13
  • 83
  • 131
  • Why dont you run `kubectl -n my-namespace exec -it my-demo-app-58df8dc87-568gb "ls -la"` ?? – Veerendra K Sep 12 '19 at 05:48
  • `eval` is a huge bug magnet; I recommend avoiding it whenever possible. Do you really need to put the `kubectl` command in a variable instead of just executing it directly? If you do, see [BashFAQ #50: I'm trying to put a command in a variable, but the complex cases always fail!](https://mywiki.wooledge.org/BashFAQ/050) – Gordon Davisson Sep 12 '19 at 05:58
  • @Gordon Davisson thank for your point. I will try another way – Zaw Than oo Sep 12 '19 at 06:20

0 Answers0