Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a good zsh solution #69

Merged
merged 1 commit into from
Jul 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')