🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Rob McMahon Sat, 02 Sep 1989 14:09
bash 1.03 - positional parameters lost when setting flags
#532
Author: Rob McMahon
Date: Sat, 02 Sep 1989 14:09
95 lines
2157 bytes
Bash 1.03 still loses positional parameters when setting flags:

Script started on Sat Sep  2 14:53:29 1989
cudcv (28) >> ./bash -version
GNU ./bash, version 1.03.15
bash$ echo $-
o
bash$ echo $@

bash$ set a b
bash$ echo $@
a b
bash$ set -f
bash$ echo $@
			<= Oops, no positional parameters
bash$ echo $-
fo
bash$ logout
cudcv (29) >> sh
$ echo $-
s
$ echo $@

$ set a b
$ echo $@
a b
$ echo $-
s
$ set -f
$ echo $@
a b			<= fine with the Bourne shell
$ echo $-
sf
$ ^D
cudcv (30) >> x
exit

script done on Sat Sep  2 14:55:46 1989

After fix below ...

Script started on Sat Sep  2 14:59:15 1989
cudcv (31) >> ./bash -version
GNU ./bash, version 1.03.16
in .profile
bash$ echo $-
o
bash$ echo $@

bash$ set a b
bash$ echo $@
a b
bash$ set -f
bash$ echo $@
a b			<= still okay
bash$ echo $-
fo
bash$ logout
cudcv (32) >> x
exit

script done on Sat Sep  2 15:00:32 1989

And the suggested fix ...

===================================================================
RCS file: builtins.c,v
retrieving revision 1.1
diff -c -r1.1 builtins.c
*** /tmp/,RCSt1a05272	Sat Sep  2 15:01:35 1989
--- builtins.c	Sat Sep  2 15:01:18 1989
***************
*** 1842,1848 ****
      }
  
    /* Assigning $1 ... $n */
!   remember_args (list, 1);
    return (EXECUTION_SUCCESS);
  }
  
--- 1842,1849 ----
      }
  
    /* Assigning $1 ... $n */
!   if (list)
!     remember_args (list, 1);
    return (EXECUTION_SUCCESS);
  }
  

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads