Merge pull request #400 from johannesgerer/master

Only use colors if stdout is a terminal.
pull/401/head
William Ting 8 years ago
commit 7ee214c9c2

@ -61,7 +61,11 @@ j() {
output="$(autojump ${@})"
if [[ -d "${output}" ]]; then
echo -e "\\033[31m${output}\\033[0m"
if [ -t 1 ]; then # if stdout is a terminal, use colors
echo -e "\\033[31m${output}\\033[0m"
else
echo -e "${output}"
fi
cd "${output}"
else
echo "autojump: directory '${@}' not found"

@ -52,7 +52,11 @@ j() {
setopt localoptions noautonamedirs
local output="$(autojump ${@})"
if [[ -d "${output}" ]]; then
echo -e "\\033[31m${output}\\033[0m"
if [ -t 1 ]; then # if stdout is a terminal, use colors
echo -e "\\033[31m${output}\\033[0m"
else
echo -e "${output}"
fi
cd "${output}"
else
echo "autojump: directory '${@}' not found"

Loading…
Cancel
Save