Edouard Klein
unread,Dec 4, 2024, 5:09:02 AM12/4/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to infer...@googlegroups.com
Hi all :)
I have trouble understanding how the @ operator works in sh.
sh(1) states:
@ command ...
Execute command in a subshell, allowing (for instance) the
name-space to be forked independently of main shell.
Now, on an Inferno prompt, here is what I try:
; memfs /mnt/ram
; echo coucou > /mnt/ram/greetings
; cat /mnt/ram/greetings
coucou
; cat /mnt/ram2/greetings
cat: cannot open /mnt/ram2/greetings: '/mnt/ram2/greetings' does not
exist
; # This was expected
; sh -c { bind /mnt/ram /mnt/ram2; cat /mnt/ram2/greetings }
coucou
# Now the ram2/greetings file existed in the subshell created by sh -c
# and the greetings appear
; cat /mnt/ram2/greetings
cat: cannot open /mnt/ram2/greetings: '/mnt/ram2/greetings' does not exist
# And this is also expected, as the initial namespace was not modified
So far, so good.
Now, with @:
; @ { bind /mnt/ram /mnt/ram2; cat /mnt/ram2/greetings }
coucou
; cat /mnt/ram2/greetings
coucou
Why was the original namespace modified ? Isn't @ supposed independently
fork the name-space of the main shell, as explained in the doc ?
Cheers,
Edouard.