24 lines
		
	
	
	
		
			438 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			438 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| zig_len=7 zag_len=20 zog_len=50
 | |
| offset=$(( zag_len - zig_len ))
 | |
| 
 | |
| for (( idx = 0; idx < zig_len; idx += 1 )); do
 | |
|   zigs+=*
 | |
| done
 | |
| 
 | |
| for (( idx = 0; idx < zog_len; idx += 1 )); do
 | |
|   printf '%*s%s\n' "$offset" "" "$zigs"
 | |
| 
 | |
|   if (( (offset + zig_len) == zag_len )); then
 | |
|     dir=left
 | |
|   elif (( offset == 0 )); then
 | |
|     dir=right
 | |
|   fi
 | |
| 
 | |
|   if [[ $dir = left ]]; then
 | |
|     (( offset -= 1 ))
 | |
|   else
 | |
|     (( offset += 1 ))
 | |
|   fi
 | |
| done
 |