cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
5,180 Views
Registered: ‎02-08-2017

Running TCL script from Shell script

Jump to solution

Hello I need to run vivado in tcl mode within a linux shell script. I can do something like that

 

 

#!/bin/csh -e
vivado -mode tcl -nojournal -nolog -notrace -source syn.tcl 
echo "going to rest of shell script ...."

 

my question is: I need to cause this script to stop running if vivado encountered a problem during synthesis operation.

i.e If the command "vivado -mode tcl -nojournal -nolog -source syn.tcl -notrace" got an error, I don't need the command "echo "going to rest of shell script ...." to be executed

 

So is there a way to get a return value from vivado command

 

Thanks in Advance

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Voyager
Voyager
6,789 Views
Registered: ‎06-24-2013

Hey @moibrahim,

 

#!/bin/bash

vivado -nolog -nojournal -notrace -mode batch -source syn.tcl
echo "return code $?"

... will show you the return code, where '0' means success and everything else in an error.

 

Note that you can also chain commands like this ...

vivado -mode batch -source syn.tcl && echo "success" || echo "failed

... or if you want to do more than a single command ...

vivado -mode batch -source syn.tcl && {
   echo "success."
   echo "all done."
} || {
   echo "error."
   echo "aborted."
}

Hope this helps,

Herbert

-------------- Yes, I do this for fun!

View solution in original post

0 Kudos
3 Replies
Highlighted
Voyager
Voyager
6,790 Views
Registered: ‎06-24-2013

Hey @moibrahim,

 

#!/bin/bash

vivado -nolog -nojournal -notrace -mode batch -source syn.tcl
echo "return code $?"

... will show you the return code, where '0' means success and everything else in an error.

 

Note that you can also chain commands like this ...

vivado -mode batch -source syn.tcl && echo "success" || echo "failed

... or if you want to do more than a single command ...

vivado -mode batch -source syn.tcl && {
   echo "success."
   echo "all done."
} || {
   echo "error."
   echo "aborted."
}

Hope this helps,

Herbert

-------------- Yes, I do this for fun!

View solution in original post

0 Kudos
Highlighted
Explorer
Explorer
5,142 Views
Registered: ‎02-08-2017
Thanks Herbert .. this really helped
0 Kudos
Highlighted
Voyager
Voyager
5,133 Views
Registered: ‎06-24-2013

You're welcome!

 

All the best,

Herbert

-------------- Yes, I do this for fun!
0 Kudos