Probably need to defer interpretation of $? - looks like it may be getting
evaluated early.

On Sat, Nov 7, 2020 at 4:23 AM Johan Mazel <johan.ma...@gmail.com> wrote:

> Hello
> I created a setup single box which a Debian Buster.
> I am trying to execute a command in a box and get its return code printed
> to stdout.
>
> I run "ls; echo $?; ls toto; echo $?" where toto is not present.
> On the host, the ouput is:
> *content of directory*
> 0
> ls: cannot access 'toto': No such file or directory
> 2
> I get the 2 value because toto is not present.
>
> Then I do "vagrant ssh client -c 'ls; echo $?; ls toto; echo $?'" (toto is
> again not present), and I get the following output:
> *content of directory*
> 0
> ls: cannot access 'toto': No such file or directory
> 0
>
> Why is the return code/status of the second ls 0?
>
> Thank you for your time.
> Best regards,
> Johan Mazel
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/hashicorp/vagrant/issues
> Discuss: https://discuss.hashicorp.com/c/vagrant/24
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/24b4eaa7-795d-4cbd-b30c-87fe1b9c7307n%40googlegroups.com
> <https://groups.google.com/d/msgid/vagrant-up/24b4eaa7-795d-4cbd-b30c-87fe1b9c7307n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vagrant-up+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CACEPCkSiBsvcwmykF_dy%2BOw33788beF58%2B2eRmaPL2XNDTk18w%40mail.gmail.com.

Reply via email to