setup line content early
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								9e40d7bc91
							
						
					
				
			
			
				commit
				
					
						1e3f0749fc
					
				
			
		
					 1 changed files with 2 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -25,6 +25,7 @@ state_should="present"
 | 
			
		|||
[ -f "$__object/parameter/file" ]  && file=$(cat "$__object/parameter/file")
 | 
			
		||||
[ -f "$__object/parameter/regex" ] && regex=$(cat "$__object/parameter/regex")
 | 
			
		||||
[ -f "$__object/parameter/state" ] && state_should=$(cat "$__object/parameter/state")
 | 
			
		||||
[ -f "$__object/parameter/line" ]  && line=$(cat "$__object/parameter/line")
 | 
			
		||||
 | 
			
		||||
state_is="$(cat "$__object/explorer/state")"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,11 +33,9 @@ state_is="$(cat "$__object/explorer/state")"
 | 
			
		|||
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    present)
 | 
			
		||||
        if [ ! -f "$__object/parameter/line" ]; then
 | 
			
		||||
        if [ ! "$line" ]; then
 | 
			
		||||
            echo "Required parameter \"line\" is missing" >&2
 | 
			
		||||
            exit 1
 | 
			
		||||
        else
 | 
			
		||||
            line=$(cat "$__object/parameter/line")
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        echo "echo \"$line\" >> $file"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue