Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Elegance and truth are inversely related. -- Becker's Razor


devel / comp.unix.shell / Terrible frightening function defined in the intel oneapi toolkits envirionment settings.

SubjectAuthor
* Terrible frightening function defined in the intel oneapi toolkitshongy...@gmail.com
+- Re: Terrible frightening function defined in the intel oneapiGrant Taylor
+- Re: Terrible frightening function defined in the intel oneapiJanis Papanagnou
`- Re: Terrible frightening function defined in the intel oneapiWayne

1
Terrible frightening function defined in the intel oneapi toolkits envirionment settings.

<9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4836&group=comp.unix.shell#4836

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:6214:23ca:: with SMTP id hr10mr29783083qvb.82.1640904464139;
Thu, 30 Dec 2021 14:47:44 -0800 (PST)
X-Received: by 2002:a05:622a:1392:: with SMTP id o18mr27831397qtk.270.1640904464013;
Thu, 30 Dec 2021 14:47:44 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 30 Dec 2021 14:47:43 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=203.175.13.154; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 203.175.13.154
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
Subject: Terrible frightening function defined in the intel oneapi toolkits
envirionment settings.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Thu, 30 Dec 2021 22:47:44 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 17
 by: hongy...@gmail.com - Thu, 30 Dec 2021 22:47 UTC

I use lmod to generate the corresponding module files of Intel oneapi, and find the following code snippets in the result:

werner@X10DAi-00:/opt/intel/oneapi$ sh_to_modulefile setvars.sh
[...]
set_shell_function("save_args"," \
for arg in \"$@\";\
do\
printf \"%s\\n\" \"$arg\" | sed -e \"s/'/'\\\\\\\\''/g\" -e \"1s/^/'/\" -e \"\\$s/\\$/' \\\\\\\\/\";\
done;\
echo \" \"\
","")

There are so many '\' in it, which dazzles me. It this a good style of shell script?

Regards,
HZ

Re: Terrible frightening function defined in the intel oneapi toolkits envirionment settings.

<sqleer$j5t$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4837&group=comp.unix.shell#4837

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.unix.shell
Subject: Re: Terrible frightening function defined in the intel oneapi
toolkits envirionment settings.
Date: Thu, 30 Dec 2021 16:13:48 -0700
Organization: TNet Consulting
Message-ID: <sqleer$j5t$1@tncsrv09.home.tnetconsulting.net>
References: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 30 Dec 2021 23:13:31 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="19645"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
Content-Language: en-US
 by: Grant Taylor - Thu, 30 Dec 2021 23:13 UTC

On 12/30/21 3:47 PM, hongy...@gmail.com wrote:
> There are so many '\' in it, which dazzles me. It this a good style
> of shell script?

I would not call it /good/ by any stretch of the imagination.

Sometimes it's /necessary/ to do things like that.

The eight (8) backslashes tell me that it's an escape of an escape of an
escape of an escape.

1st: \
2nd: \\
3rd: \\\\
4th: \\\\\\\\

The thought of needing four levels of escaping makes me shudder. I
would think that there would have to be a better way to do what's being
done.

--
Grant. . . .
unix || die

Re: Terrible frightening function defined in the intel oneapi toolkits envirionment settings.

<sqms42$pct$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4838&group=comp.unix.shell#4838

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Terrible frightening function defined in the intel oneapi
toolkits envirionment settings.
Date: Fri, 31 Dec 2021 13:12:50 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <sqms42$pct$1@dont-email.me>
References: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 31 Dec 2021 12:12:50 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2115462d67959457237aedc36f981c75";
logging-data="26013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UFnfhDLA6vTUUgZZWWFi5"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:4rds1Iu5mDxGOzQAeo+NoRAUXLs=
In-Reply-To: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Fri, 31 Dec 2021 12:12 UTC

On 30.12.2021 23:47, hongy...@gmail.com wrote:
> I use lmod to generate the corresponding module files of Intel oneapi, and find the following code snippets in the result:
>
> werner@X10DAi-00:/opt/intel/oneapi$ sh_to_modulefile setvars.sh
> [...]
> set_shell_function("save_args"," \
> for arg in \"$@\";\
> do\
> printf \"%s\\n\" \"$arg\" | sed -e \"s/'/'\\\\\\\\''/g\" -e \"1s/^/'/\" -e \"\\$s/\\$/' \\\\\\\\/\";\
> done;\
> echo \" \"\
> ","")
>
> There are so many '\' in it, which dazzles me.

This looks like shell code that is just _embedded_ in some *other*
language. Try a newsgroup/forum of *that* language to get an answer!

> It this a good style of shell script?

Of course not. But the horrific number of '\' is not (not alone) a
shell question in this context.

I suggest to remove the unnecessary escapes at the outer level to
create pure (functional correct) shell code and then post this code
to see where there's potential for optimization or use of other tools.

Janis

>
> Regards,
> HZ
>
>

Re: Terrible frightening function defined in the intel oneapi toolkits envirionment settings.

<sqnt9j$c5l$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=4839&group=comp.unix.shell#4839

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: way...@nospam.invalid (Wayne)
Newsgroups: comp.unix.shell
Subject: Re: Terrible frightening function defined in the intel oneapi
toolkits envirionment settings.
Date: Fri, 31 Dec 2021 16:38:59 -0500
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <sqnt9j$c5l$1@dont-email.me>
References: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 31 Dec 2021 21:38:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="dae1eac67e0befe1fd7644e473e39ba9";
logging-data="12469"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fwHMUhBxSolqAiWiqSw7cpbbayAcw2po="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.1
Cancel-Lock: sha1:rXw4OwRstoyS0YDNIqoReJFgym8=
In-Reply-To: <9d1c21c9-11dc-4e32-b32c-06ebcd9b3031n@googlegroups.com>
Content-Language: en-US
 by: Wayne - Fri, 31 Dec 2021 21:38 UTC

On 12/30/2021 5:47 PM, hongy...@gmail.com wrote:
> I use lmod to generate the corresponding module files of Intel oneapi, and find the following code snippets in the result:
>
> werner@X10DAi-00:/opt/intel/oneapi$ sh_to_modulefile setvars.sh
> [...]
> set_shell_function("save_args"," \
> for arg in \"$@\";\
> do\
> printf \"%s\\n\" \"$arg\" | sed -e \"s/'/'\\\\\\\\''/g\" -e \"1s/^/'/\" -e \"\\$s/\\$/' \\\\\\\\/\";\
> done;\
> echo \" \"\
> ","")
>
> There are so many '\' in it, which dazzles me. It this a good style of shell script?
>
> Regards,
> HZ
>
>

Merely 8 escapes? You should take a look at old nroff/troff macros;
I remember seeing 64 backslashes. Sadly, sometimes there is no
great alternative.

--
Wayne

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor