Skip to content

Commit

Permalink
Merge pull request #69 from o11c/zsh
Browse files Browse the repository at this point in the history
Add a good zsh solution
  • Loading branch information
Russell Harmon committed Jul 27, 2014
2 parents 1158fde + 663ceea commit 883b849
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions solutions/complete/zsh/soln1/goal.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/zsh
# This solution uses no external commands and does not open itself as input.
# Shells do not support the concept of returning strings from functions.

debug_trap()
{
if [[ "${ZSH_DEBUG_CMD/ }" == 'g('* ]]
then
local cmd
cmd=${ZSH_DEBUG_CMD//'()'/o}
rv=${cmd//[^a-z]/}
echo $rv
set -e
return
fi
}

al=1
trap debug_trap DEBUG

g()()()('al')
g()()('al')
g()('al')
g('al');
g()('at')
g()()('at')
g()()()('at')

0 comments on commit 883b849

Please sign in to comment.