Windows Bash/WSL System Calls

4 vues (au cours des 30 derniers jours)
Stephen P
Stephen P le 27 Mai 2017
Hello,
Windows 10 has a bash environment based on Trusty Ubuntu (14.04). In the windows command prompt, you can call bash commands like this:
bash -c "lsb_release -a"
I expected that a Matlab
system('bash -c "lsb_release -a"')
or
dos('bash -c "lsb_release -a"')
call or ! bash -c "lsb_release -a" would show the same behavior. However, it does not. I receive an Eans=-1 return. Why is this? Is there a way around it? Running r2012a.

Réponses (2)

David Crist
David Crist le 9 Sep 2017
Modifié(e) : David Crist le 9 Sep 2017
This is a problem for me as well. The problem with relying on
!bash -c ls /a/path/variable/
Is that you can't use the ! syntax with variables. I'm surprised there isn't a proper fix or response to this.
Also, the below is invalid matlab:
[status,output] = !bash -c ls

Mahsa Ghasemi
Mahsa Ghasemi le 10 Juil 2017
Hi,
One way of calling bash inside MATLAB on a Windows 10 platform is to use "!", e.g.,
!bash bashScript.sh

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by