So, this is strange. When I manually run commands it all works fine, but when I run a script with identical commands, I get strange error output.
This is what I run:
lxc list;
for elem in {001..005}; do lxc stop ubuntu-"$elem"; done;
for elem in {001..005}; do lxc start ubuntu-"$elem"; done;
lxc list;
When I do that manually, all works with no error and my command have an actual effect. LXD machines are actually getting stopped and started again.
However, if I just write this as a script:
#!/bin/bash
lxc list;
for elem in {001..005}; do lxc stop ubuntu-"$elem"; done;
for elem in {001..005}; do lxc start ubuntu-"$elem"; done;
lxc list;
I get errors (very uninformative ones, I guess about not finding machines to run command against).
error: not found
error: not found
For both loop commands.
I'm new here so please advise.
/bin/bashthat runs the script. Can you runprintenvin a script and see if that matchesprintenvoutput from the interactive (login) shell?sh -x scriptand paste the output?