mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Merge pull request #400 from johannesgerer/master
Only use colors if stdout is a terminal.
This commit is contained in:
commit
7ee214c9c2
@ -61,7 +61,11 @@ j() {
|
||||
|
||||
output="$(autojump ${@})"
|
||||
if [[ -d "${output}" ]]; then
|
||||
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
|
||||
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…
Reference in New Issue
Block a user