--regex to make __addifnosuchline more flexible
This commit is contained in:
		
					parent
					
						
							
								745cf47e43
							
						
					
				
			
			
				commit
				
					
						6d55d7ae82
					
				
			
		
					 2 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
					@ -26,12 +26,18 @@ else
 | 
				
			||||||
   file="/$__object_id"
 | 
					   file="/$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
regex=$(cat "$__object/parameter/line")
 | 
					if [ -f "$__object/parameter/regex" ]; then
 | 
				
			||||||
 | 
					    regex=$(cat "$__object/parameter/regex")
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    wrap=$(cat "$__object/parameter/line")
 | 
				
			||||||
 | 
					    regex="^$wrap\$"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -f "$file" ]; then
 | 
					if [ -f "$file" ]; then
 | 
				
			||||||
   # sh -e is our environment, we know what we do,
 | 
					   # sh -e is our environment, we know what we do,
 | 
				
			||||||
   # skip error detection for now
 | 
					   # skip error detection for now
 | 
				
			||||||
   set +e
 | 
					   set +e
 | 
				
			||||||
   grep -q "^$regex\$" "$file"
 | 
					   grep -q "$regex" "$file"
 | 
				
			||||||
   if [ $? -eq 1 ]; then
 | 
					   if [ $? -eq 1 ]; then
 | 
				
			||||||
      echo "NOTFOUND"
 | 
					      echo "NOTFOUND"
 | 
				
			||||||
   else
 | 
					   else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1,2 @@
 | 
				
			||||||
file
 | 
					file
 | 
				
			||||||
 | 
					regex
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue