* [Patch] remove awk dependency from zfanon
@ 2009-09-12 13:02 Baptiste Daroussin
0 siblings, 0 replies; only message in thread
From: Baptiste Daroussin @ 2009-09-12 13:02 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 149 bytes --]
Hi
Here is a patch that replace awk with zsh equivalent in zfanon
now only zfinit uses awk I'll have a look at this in the next days
regards,
Bapt
[-- Attachment #2: zfanon-noawk.patch --]
[-- Type: application/octet-stream, Size: 885 bytes --]
diff --git a/Functions/Zftp/zfanon b/Functions/Zftp/zfanon
index 5dc2261..336609b 100644
--- a/Functions/Zftp/zfanon
+++ b/Functions/Zftp/zfanon
@@ -23,12 +23,11 @@ if [[ -z $EMAIL_ADDR ]]; then
host=$HOST
elif [[ -f /etc/resolv.conf ]]; then
# Next, maybe we've got resolv.conf.
- domain=$(awk '/domain/ { print $2 }' /etc/resolv.conf)
+ domain=${${=${(M)${(f)"$(</etc/resolv.conf)"}:#domain*}}[2]}
[[ -n $domain ]] && host=$HOST.$domain
fi
- # Next, maybe we've got nlsookup. May not work on LINUX.
- [[ -z $host ]] && host=$(nslookup $HOST 2>/dev/null |
- awk '/Name:/ { print $2 }')
+ # Next, maybe we've got nslookup. May not work on LINUX.
+ [[ -z $host ]] && host=${${=${(M)${(f)"$(nslookup $HOST 2>/dev/null)"}:#Name:*}}[2]}
if [[ -z $host ]]; then
# we're running out of ideas, but this should work.
# after all, i wrote it...
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-12 13:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-12 13:02 [Patch] remove awk dependency from zfanon Baptiste Daroussin
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).