Skip to content

Commit

Permalink
redirect to /dev/null instead of '-q' option for solaris 10 or earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
uchida committed Jul 29, 2013
1 parent 6de4108 commit 805f6ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion z.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ elif complete >/dev/null 2>&1; then
complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z}
[ "$_Z_NO_PROMPT_COMMAND" ] || {
# populate directory list. avoid clobbering other PROMPT_COMMANDs.
grep -q "_z --add" <<< "$PROMPT_COMMAND" || {
grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || {
PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''_z --add "$(pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;'
}
}
Expand Down

1 comment on commit 805f6ff

@knu
Copy link

@knu knu commented on 805f6ff Jul 30, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use a glob match intead of calling grep(1).

[[ -n "$_Z_NO_PROMPT_COMMAND" || "$PROMPT_COMMAND" == *'_z_cmd --add '* ]]

cf. https://github.com/knu/z/blob/master/src/z.interactive.bash#L2

Please sign in to comment.