UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
1,681 Views
Registered: ‎11-08-2017

[ModelSim] how to run a bash script from within ModelSim?

Jump to solution

Hi All,

 

I'd like to run a bash script from within ModelSim. How can I do so?

 

Thank you!

0 Kudos
1 Solution

Accepted Solutions
Scholar jmcclusk
Scholar
2,209 Views
Registered: ‎02-24-2014

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

Ah!   you didn't say this was Ubuntu on Windows 10!    you need to search for the file,  "bash.exe" and provide that in your command to exec..

 

This might work:

exec  "C:\\Windows\\System32\\bash.exe a.bsh"

 

If this doesn't work, try this form:

 

exec  "C:/Windows/System32/bash.exe a.bsh"

 

you might not need the explicit path to bash if you already have bash.exe in your windows path environment.  

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos
6 Replies
Scholar jmcclusk
Scholar
1,668 Views
Registered: ‎02-24-2014

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

Use the TCL EXEC command to invoke a subprocess.   You should be able to call a bash script using EXEC

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos
Adventurer
Adventurer
1,666 Views
Registered: ‎11-08-2017

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

OK, I tried this command ...

 

I created a bash script, which just echo some string.

 

But when I call to this script, I'm receiving the following:

%> exec a.bsh
%> couldn't execute "a.bsh": no such file or directory

When I check whether the file script exist, it does:

%> ls a.bsh
%> a.bsh       

So, what's the problem? All the above commands were run from the ModelSim Transcriptt window.

 

 

 

0 Kudos
Scholar jmcclusk
Scholar
1,663 Views
Registered: ‎02-24-2014

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

try  exec "./a.bsh"  and also make sure that a.bsh has the execute bit set.  "chmod +x a.bsh"

 

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos
Adventurer
Adventurer
1,644 Views
Registered: ‎11-08-2017

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

this is a Windows 10 with Ubuntu on-board...

 

How can i use chmod+x for window?

 

The ModelSim is running on Windows .... 

 

0 Kudos
Scholar jmcclusk
Scholar
2,210 Views
Registered: ‎02-24-2014

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

Ah!   you didn't say this was Ubuntu on Windows 10!    you need to search for the file,  "bash.exe" and provide that in your command to exec..

 

This might work:

exec  "C:\\Windows\\System32\\bash.exe a.bsh"

 

If this doesn't work, try this form:

 

exec  "C:/Windows/System32/bash.exe a.bsh"

 

you might not need the explicit path to bash if you already have bash.exe in your windows path environment.  

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos
Adventurer
Adventurer
1,595 Views
Registered: ‎11-08-2017

Re: [ModelSim] how to run a bash script from within ModelSim?

Jump to solution

"you might not need the explicit path to bash if you already have bash.exe in your windows path environment" - how can I add this path to the window path environment?

0 Kudos