pass tmpfile name to awk in a variable. BSD awk (which OSX appears to use) doesn't like to redirect to concatenated filenames, and FILENAME is not available in the BEGIN clause, which is where i'd like to concatenate it, so this seemed the best approach. Closes gh-1

This commit is contained in:
rupa committed 2009-07-02 12:18:53 -04:00
1 parent 66cb4864b0
commit eacb0e8cd3
1 file changed
+2 -2
+2 -2
View File
@@ -64,7 +64,7 @@ z() {
# if we hit enter on a completion just go there
[ -d "$last" ] && cd "$last" && return
[ -f "$datafile" ] || return
cd="$(awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
cd="$(awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -v tmpfl="$datafile.tmp" -F"|" '
function frecent(rank, time) {
dx = t-time
if( dx < 3600 ) return rank*4
@@ -99,7 +99,7 @@ z() {
BEGIN { split(q, a, " ") }
{
if( system("test -d \"" $1 "\"") ) next
print $0 >> FILENAME ".tmp"
print $0 >> tmpfl
if( typ == "rank" ) {
f = $2
} else if( typ == "recent" ) {