1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# getopts tests
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# this should fail
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								getopts
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								echo $?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								getopts opts
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								echo $?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# maybe someday we will have a ksh93-like -a argument to set the name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# used in error messages, but not yet
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								getopts -a opts name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts1.sub -a -b bval one two three
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# make sure getopts works when there are more than 9 positional parameters
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts1.sub -a -b 
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts2.sub -ad -c cval three four five
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts3.sub
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# make sure that `-b bval' and `-bbval' are equivalent
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts4.sub -a -b bval one two three
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts4.sub -a -bbval one two three
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# this tests `silent' error reporting
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts4.sub -a -b
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts4.sub -a -c
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# make sure that `--' can be used to end the list of options
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts4.sub -a -- -b bval one two three
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts5.sub -a -c
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts6.sub -a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts6.sub -a -c
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts6.sub -ac
							 | 
						
					
						
							
								
									
										
										
										
											1997-06-05 14:59:13 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								echo $? # this should be 2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-04-17 19:52:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								${THIS_SH} ./getopts7.sub -a
							 |