LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute a bash script

I want to execute a bash script (*.sh) from LabVIEW.  I have installed Ubuntu on WSL (https://ubuntu.com/wsl) and when I execute the "bash" command from the command line it works fine.  However, when I execute the "bash" command from LabVIEW command exe it gets the error "Access is denied".  Also, when I execute the "bash" command from a elevated command line I also get the "Access is denied".

 

Anybody know what going on here?  Does LabVIEW execute the command exe elevated?  If so, can I run it not elevated? Or, how can I run "bash" from an elevated cmd?

 

Alternate, are there other means of executing a bash script from LabVIEW?

0 Kudos
Message 1 of 8
(3,047 Views)

Not an expert but a fan.

 

What did you do Paul?

 

And did you mean "Bash", or "Splat"  I'm only asking because *. Looks like a splat and I've been trained that ! Is a bash.

 

And I haven't had a lot of experience with shell.  I think that I can learn something!


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 8
(2,999 Views)

How do you execute the script from LabVIEW? Where is the script located? What are the access rights of that script?

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 8
(2,986 Views)

With ubuntu installed on Windows 10 following WSL install instruction (enable WSL in windows features of add/remove programs, reboot, install ubuntu from MS store) I can get the bash prompt by typing bash from the cmd line.  But when I execute "bash" from LabVIEW's system exe I get access denied.  Additionally, I get the same error when run from an elevated command prompt.

 

bash.pngsystemExe.pngCMDAdmin.png

0 Kudos
Message 4 of 8
(2,955 Views)

I haven't actually executed the script yet fully.  It requires some hardware and was returning errors.  But that is from the bash shell in ubuntu.  Reading online, I should be able to execute it from CMD using the "bash" command with the script as an input argument.  But, I can't even get that far because of the bash command itself causing the access denied error.

0 Kudos
Message 5 of 8
(2,944 Views)

What exactly is this script doing? I would highly encourage you to investigate directly communicating with the device rather than using command line scripts. Permissions can get weird in Windows especially if you are doing anything with network drives. Applications will run as different users. For instance, running as administrator will often result in network drives not being accessible. The administrator is a local account and network drives require domain accounts to access them. You may be falling into a similar situation going through WSL. If it were me though, I would be looking to implement whatever the script is doing directly in LabVIEW and communicate directly with the external device. If the script can do, LabVIEW should be able to as well.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 8
(2,929 Views)

The script is coming from the software R&D group.  It is a script that they run to calibrate the product.  It uses SSH to communicate with the DUT for the most part.

 

Right now I am in a pickle.  There are currently two implementations for doing the calibration.  One written in LabVIEW by someone in manufacturing (not me) and one written in the bash script by the R&D group.

 

The LabVIEW version is not performing and the R&D group is blaming the language and not the application.  So, they are suggesting for me to just run their script.  I'm saying I can redo the LabVIEW code but at this point I am getting very little support from the R&D group as the previous mfg method gave them a bad impression and are not willing to work with me as much as I'd like.

 

That is where I'd like to just run their script if I can.  

0 Kudos
Message 7 of 8
(2,925 Views)

try chmod +x on the file

CLA
0 Kudos
Message 8 of 8
(119 Views)