Skip to content

Instantly share code, notes, and snippets.

@flatcap
Last active August 29, 2015 14:18
Show Gist options
  • Save flatcap/7e44ac26e150cd10511b to your computer and use it in GitHub Desktop.
Save flatcap/7e44ac26e150cd10511b to your computer and use it in GitHub Desktop.
L=$((LINES/2))
function f()
{
for A in $(seq $L); do
for B in $(seq $L); do
[ $A -lt $B ] && C=' ' || C=x
echo -n "$C "
done
echo
done
}
X=$(f | tac; f)
paste <(echo "$X") <(echo "$X" | rev) | sed 's/\t //'
S=$((LINES*2-3))
L=$(printf "x%${S}sx" "")
function g()
{
for A in $(seq $((LINES/2))); do
echo "$L"
L=$(echo "$L" | sed 's/ \( \+\)/ x\1x /')
done
}
g | tac
g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment