Skip to content

Commit

Permalink
extractScriptMetadata.sh: replace sed | awk with awk
Browse files Browse the repository at this point in the history
Avoid the common antipattern [1] and reimplement the entire script in Awk instead.

[1] http://www.iki.fi/era/unix/award.html#grep
  • Loading branch information
tripleee committed Apr 28, 2017
1 parent ab1fbdd commit 87b6d1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion extractScriptMetadata.sh
@@ -1,2 +1,2 @@
#!/bin/bash
sed -e '/./{H;$!d;}' -e 'x;/UserScript/!d;' $1 | awk '!/^$/' > ${1/.user./.meta.}
awk '/./; /\/UserScript/ { exit }' "$1" > "${1/.user./.meta.}"

0 comments on commit 87b6d1b

Please sign in to comment.