Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Silent sourcing of setvars.sh?

Zambon__Joseph
Beginner
316 Views

Hello, I'm just wondering if there is a way to source setvars.sh while suppressing any output. Currently sourcing that gives the following

[login shell]

:: initializing oneAPI environment ...
-bash: BASH_VERSION = 4.4.20(1)-release
args: Using "$@" for setvars.sh arguments:
:: advisor -- latest
:: ccl -- latest
:: clck -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: inspector -- latest
:: intelpython -- latest
:: ipp -- latest
:: ippcp -- latest
:: ipp -- latest
:: itac -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vpl -- latest
:: vtune -- latest
:: oneAPI environment initialized ::

This causes a problem with programs such as rsync which do not expect the server to return such a long string after login, giving the following error... "protocol version mismatch -- is your shell clean?"

 

Thanks!

 

-Joe

0 Kudos
5 Replies
jimdempseyatthecove
Black Belt
288 Views

Can you redirect the console output of the source command to NUL?

Jim Dempsey

 

Ron_Green
Moderator
278 Views

is the 'source' command in a script?

Or did you put the 'source' in your .bashrc or another dot file?  If you put it in .bashrc, for example, all subshells will do the 'source'. Perhaps you only want the 'source' in true interactive shells?  I'm not sure if rsync invokes an interactive or non-interactive shell on the remote host - do you know?  https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

https://superuser.com/questions/965987/why-does-rsync-read-bashrc-and-not-profile

 

The above suggests rsync is non-interactive but that thread is from 2015.  Probably still true though.  So again, for rsync you may want to put the 'source' in .profile instead of .bashrc so it's only for interactive shell invocation. 

 

 

Jacob_Williams
New Contributor I
109 Views

Yeah, this script needs an argument to suppress the prints. They are also messing me up. Appending `2>&1 /dev/null` doesn't seem to do anything?

Ron_Green
Moderator
99 Views

what OS and version are you using?

This worked from command line on Fedora 35

Are you putting the 'source' into a dot file?  if so, which one?

 

source /nfs/pdx/disks/cts2/tools/oneapi/2023.0.0/setvars.sh > /dev/null 2>&1

 

works from command line for me.  I can possibly see an issue with this in a dot file.

JohnNichols
Valued Contributor II
87 Views

linux for those who have trouble carrying the full UNIX mass or weight if you are into Imperial.

--------------------------------------------------------------

 

The Unix operating system consists of many libraries and utilities along with the master control program, the kernel. The kernel provides services to start and stop programs, handles the file system and other common "low-level" tasks that most programs share, and schedules access to avoid conflicts when programs try to access the same resource or device simultaneously. To mediate such access, the kernel has special rights, reflected in the distinction of kernel space from user space, the latter being a priority realm where most application programs operate.

---------------------------------------------------------------

The kernel is just a simple human consciousness replacement - what do I do next. 

 

Interesting. 

Reply