Re: Fwd: Re: interactive shell detection in shrc

RVP <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
On Tue, 24 Sep 2024, Steffen Nurpmeso wrote:

> Robert Elz wrote in
> <[email protected]>:
> |    Date:        Tue, 24 Sep 2024 00:56:40 +0200
> [...]
> | if $___SHRC
>
> Oh, i would be afraid of doing this implicit test.  I no longer
> have many shells around, not even as source code, so i would not
> dare to do this.
>

Yes, this surprised me too. This test is true if $___SHRC is undefined,
which is why kre said,

> |If you insist on quoting the expansion in the first line,
> |it needs to become:
> |
> | if "${___SHRC:-:}"
>
> A syntax error of yours?
>

No, that becomes `if ":" ...' $___SHRC is undefined or empty. You need to
write it that way, else it's a syntax error.

> |with the similar variation if you want the ___SHRC$$ expansion
> |quoted:
> | if eval "\"\${___SHRC$$:-:}\""
> |
>
> You do it once again?
>

Just the same if quoting is needed.

> years; especially since on this laptop the "g" key stopped working
> after a few weeks, and ever since i have to use
>
>  keycode  41 = f F g G g G
>

Heh. I had to do the same on one of my old laptops; except a lot more keys
were non-functional, so:

```
$ cat /mnt/bak/sdf/tmp/nbsd/qey.sh 
#!/bin/sh

wsconsctl -dw font='Boldface 16x32'
wsconsctl -w encoding=us.swapctrlcaps
while read line
do      wsconsctl -w map+="$line"
done <<\EoF
keycode 1 = grave asciitilde
keycode 14 = BackSpace
keycode 211 = KP_Delete
keycode 41 = Escape
keycode 24 = o O i I
keycode 31 = s S a A
keycode 33 = f F d D
keycode 35 = h H g G
keycode 38 = l L k K
keycode 49 = n N m M
keycode 52 = period greater slash question
keycode 219 = Mode_switch
EoF
$
```

You produce the broken keys using Win+adjacent-to-broken key.

(Why is the script called `qey.sh' instead of `key.sh'? Because the `k' key is
broken :))

-RVP
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.