Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5960 Discussions

Fix in setupvars.sh in /opt/intel/computer_vision_sdk_2018.2.319/bin [Ubuntu 16.04]

Mickael_T
Beginner
286 Views

Just reporting a modification required to the initial scrip to be able to run without issue.

Current the script  called setupvars.sh released with OpenVino 2018.2.319 has the following shebang: #!/bin/sh

It produces the following error when executed from .profile:

~$ source .profile
./setupvars.sh: 30: ./setupvars.sh: [[: not found
./setupvars.sh: 36: ./setupvars.sh: [[: not found
./setupvars.sh: 62: ./setupvars.sh: [[: not found
./setupvars.sh: 66: ./setupvars.sh: [[: not found
[setupvars.sh] OpenVINO environment initialized

Modification of the shebang as follow fixes the problem: #!/bin/bash

The result is:

source .profile
[setupvars.sh] OpenVINO environment initialized

 

 

 

 

0 Kudos
2 Replies
Monique_J_Intel
Employee
286 Views

Hi Michael,

Thanks for your feedback on this. We don't currently have documentation on how to update the shell initialization scripts such as .profile on Linux but it'll add this as a request since this makes it easier to not have to source the setupvar.sh every time you open a new terminal.

Kind Regards,

Monique Jones

Roubert__Joakim
Beginner
286 Views

IMO, a superior solution to the issue described is to keep the shebang as-is, while getting rid of those unnecessary bashisms. For this script, there is no need not to be POSIX compatible. I guess something like the changes found in this diff would do the trick:

< while [[ $# -gt 0 ]]
---
> while [ $# -gt 0 ]
45c45
<     if [[ -f /etc/os-release ]]; then
---
>     if [ -f /etc/os-release ]; then
55c55
<     if [[ -e ${IE_PLUGINS_PATH}/arch_descriptions ]]; then
---
>     if [ -e ${IE_PLUGINS_PATH}/arch_descriptions ]; then
60c60
<     if [[ "$OSTYPE" == "darwin"* ]]; then
---
>     if [ "$OSTYPE" = "darwin"* ]; then
70c70
<         source "$INSTALLDIR/opencv/setupvars.sh"
---
>         . "$INSTALLDIR/opencv/setupvars.sh"

BR,

/J

Reply