Squelch Bash imports in Jenkins - bash

We have a number of bash scripts running on our Jenkins server for handling our CI/CD tasks. In these tasks, we import other bash scripts or use the bash login shell for certain commands.
As part of this, we get a ton of useless output in our console. For example, with the login shell, we get tons of reporting of Ruby Version Manage initializing for the shell. Eg:
09:19:51 + for __zsh_like_cd_hook in chpwd "${chpwd_functions[#]}"
09:19:51 + typeset -f __rvm_cd_functions_set
09:19:51 + __rvm_cd_functions_set
09:19:51 + __rvm_do_with_env_before
09:19:51 + [[ -n '' ]]
09:19:51 + [[ -n /usr/local/rvm ]]
09:19:51 + source /usr/local/rvm/scripts/initialize
09:19:51 ++ [[ -n 5.0.17(1)-release ]]
09:19:51 ++ shopt -s extglob
09:19:51 ++ (( 0 == 1 ))
09:19:51 ++ export __rvm_env_loaded
09:19:51 ++ : __rvm_env_loaded:0:
09:19:51 ++ : __rvm_env_loaded:1:
09:19:51 ++ [[ -z '' ]]
09:19:51 ++ typeset -f __rvm_cleanse_variables
09:19:51 ++ __rvm_cleanse_variables
09:19:51 ++ __rvm_unset_ruby_variables
09:19:51 ++ unset rvm_env_string rvm_ruby_string rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_tag rvm_ruby_version rvm_head_flag rvm_ruby_package_file rvm_ruby_configure rvm_ruby_name rvm_ruby_url rvm_ruby_global_gems_path rvm_ruby_args rvm_ruby_name rvm_llvm_flag rvm_ruby_repo_tag
09:19:51 ++ __rvm_load_rvmrc
09:19:51 ++ typeset _file
09:19:51 ++ typeset -a rvm_rvmrc_files
09:19:51 ++ (( 0 == 1 ))
09:19:51 ++ [[ -n '' ]]
09:19:51 +++ umask
09:19:51 ++ export rvm_stored_umask=0022
09:19:51 ++ rvm_stored_umask=0022
09:19:51 ++ rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
09:19:51 ++ [[ -n /usr/local ]]
09:19:51 ++ [[ /var/lib/jenkins/.rvmrc -ef /usr/local/.rvmrc ]]
09:19:51 ++ rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
09:19:51 ++ for _file in "${rvm_rvmrc_files[#]}"
09:19:51 ++ [[ -s /etc/rvmrc ]]
09:19:51 ++ __rvm_grep '^\s*rvm .*$' /etc/rvmrc
...
Is there any way to silence this information so we have cleaner console output?

Related

Texts show up when starting Terminal

The text/code below shows up whenever I startup my terminal. This started happening after I checked a box in VSCode settings on "Send Keybindings To Shell" under the Terminal section. The texts still showed up even after I unchecked the box. I tried restarting both VScode, Terminal, my mac, and tried checking/unchecking that box in settings several times but the problem persists.
I am using MacOS (Big Sur V 11.5.2) and Zsh.
I have no idea how to pinpoint where the problem is coming from and how to solve it. I'd appreciate suggestions on what steps I can take to solve this.
EDIT:
It was tab completion info, autoload -U compinit and compinit -i, in ~/.zshrc that was causing the issue. If I comment this out, texts stop showing up. But even if I keep this part, tab completion stopped working. I'd like to keep my tab completion. Any suggestions on how to fix this?
What my terminal screen looks like when I start it:
Full text:
add-zsh-hook () {
emulate -L zsh
local -a hooktypes
hooktypes=(chpwd precmd preexec periodic zshaddhistory zshexit zsh_directory_name)
local usage="Usage: add-zsh-hook hook function\nValid hooks are:\n $hooktypes"
local opt
local -a autoopts
integer del list help
while getopts "dDhLUzk" opt
do
case $opt in
(d) del=1 ;;
(D) del=2 ;;
(h) help=1 ;;
(L) list=1 ;;
([Uzk]) autoopts+=(-$opt) ;;
(*) return 1 ;;
esac
done
shift $(( OPTIND - 1 ))
if (( list ))
then
typeset -mp "(${1:-${(#j:|:)hooktypes}})_functions"
return $?
elif (( help || $# != 2 || ${hooktypes[(I)$1]} == 0 ))
then
print -u$(( 2 - help )) $usage
return $(( 1 - help ))
fi
local hook="${1}_functions"
local fn="$2"
if (( del ))
then
if (( ${(P)+hook} ))
then
if (( del == 2 ))
then
set -A $hook ${(P)hook:#${~fn}}
else
set -A $hook ${(P)hook:#$fn}
fi
if (( ! ${(P)#hook} ))
then
unset $hook
fi
fi
else
if (( ${(P)+hook} ))
then
if (( ${${(P)hook}[(I)$fn]} == 0 ))
then
typeset -ga $hook
set -A $hook ${(P)hook} $fn
fi
else
typeset -ga $hook
set -A $hook $fn
fi
autoload $autoopts -- $fn
fi
}
compdump () {
# undefined
builtin autoload -XUz
}
compinit () {
emulate -L zsh
setopt extendedglob
typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1
typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name
while [[ $# -gt 0 && $1 = -[dDiuC] ]]
do
case "$1" in
(-d) _i_autodump=1
shift
if [[ $# -gt 0 && "$1" != -[dfQC] ]]
then
_i_dumpfile="$1"
shift
fi ;;
(-D) _i_autodump=0
shift ;;
(-i) _i_fail=ign
shift ;;
(-u) _i_fail=use
shift ;;
(-C) _i_check=
shift ;;
esac
done
typeset -gHA _comps _services _patcomps _postpatcomps
typeset -gHA _compautos
typeset -gHA _lastcomp
if [[ -n $_i_dumpfile ]]
then
typeset -g _comp_dumpfile="$_i_dumpfile"
else
typeset -g _comp_dumpfile="${ZDOTDIR:-$HOME}/.zcompdump"
fi
typeset -gHa _comp_options
_comp_options=(bareglobqual extendedglob glob multibyte multifuncdef nullglob rcexpandparam unset NO_allexport NO_aliases NO_cshnullglob NO_cshjunkiequotes NO_errexit NO_errreturn NO_globassign NO_globsubst NO_histsubstpattern NO_ignorebraces NO_ignoreclosebraces NO_kshglob NO_ksharrays NO_kshtypeset NO_markdirs NO_octalzeroes NO_posixbuiltins NO_posixidentifiers NO_shwordsplit NO_shglob NO_warnnestedvar NO_warncreateglobal)
typeset -gH _comp_setup='local -A _comp_caller_options;
_comp_caller_options=(${(kv)options[#]});
setopt localoptions localtraps localpatterns ${_comp_options[#]};
local IFS=$'\'\ \\t\\r\\n\\0\'';
builtin enable -p \| \~ \( \? \* \[ \< \^ \# 2>&-;
exec </dev/null;
trap - ZERR;
local -a reply;
local REPLY;
local REPORTTIME;
unset REPORTTIME'
typeset -ga compprefuncs comppostfuncs
compprefuncs=()
comppostfuncs=()
: $funcstack
compdef () {
local opt autol type func delete eval new i ret=0 cmd svc
local -a match mbegin mend
emulate -L zsh
setopt extendedglob
if (( ! $# ))
then
print -u2 "$0: I need arguments"
return 1
fi
while getopts "anpPkKde" opt
do
case "$opt" in
(a) autol=yes ;;
(n) new=yes ;;
([pPkK]) if [[ -n "$type" ]]
then
print -u2 "$0: type already set to $type"
return 1
fi
if [[ "$opt" = p ]]
then
type=pattern
elif [[ "$opt" = P ]]
then
type=postpattern
elif [[ "$opt" = K ]]
then
type=widgetkey
else
type=key
fi ;;
(d) delete=yes ;;
(e) eval=yes ;;
esac
done
shift OPTIND-1
if (( ! $# ))
then
print -u2 "$0: I need arguments"
return 1
fi
if [[ -z "$delete" ]]
then
if [[ -z "$eval" ]] && [[ "$1" = *\=* ]]
then
while (( $# ))
do
if [[ "$1" = *\=* ]]
then
cmd="${1%%\=*}"
svc="${1#*\=}"
func="$_comps[${_services[(r)$svc]:-$svc}]"
[[ -n ${_services[$svc]} ]] && svc=${_services[$svc]}
[[ -z "$func" ]] && func="${${_patcomps[(K)$svc][1]}:-${_postpatcomps[(K)$svc][1]}}"
if [[ -n "$func" ]]
then
_comps[$cmd]="$func"
_services[$cmd]="$svc"
else
print -u2 "$0: unknown command or service: $svc"
ret=1
fi
else
print -u2 "$0: invalid argument: $1"
ret=1
fi
shift
done
return ret
fi
func="$1"
[[ -n "$autol" ]] && autoload -Uz "$func"
shift
case "$type" in
(widgetkey) while [[ -n $1 ]]
do
if [[ $# -lt 3 ]]
then
print -u2 "$0: compdef -K requires <widget> <comp-widget> <key>"
return 1
fi
[[ $1 = _* ]] || 1="_$1"
[[ $2 = .* ]] || 2=".$2"
[[ $2 = .menu-select ]] && zmodload -i zsh/complist
zle -C "$1" "$2" "$func"
if [[ -n $new ]]
then
bindkey "$3" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] && bindkey "$3" "$1"
else
bindkey "$3" "$1"
fi
shift 3
done ;;
(key) if [[ $# -lt 2 ]]
then
print -u2 "$0: missing keys"
return 1
fi
if [[ $1 = .* ]]
then
[[ $1 = .menu-select ]] && zmodload -i zsh/complist
zle -C "$func" "$1" "$func"
else
[[ $1 = menu-select ]] && zmodload -i zsh/complist
zle -C "$func" ".$1" "$func"
fi
shift
for i
do
if [[ -n $new ]]
then
bindkey "$i" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] || continue
fi
bindkey "$i" "$func"
done ;;
(*) while (( $# ))
do
if [[ "$1" = -N ]]
then
type=normal
elif [[ "$1" = -p ]]
then
type=pattern
elif [[ "$1" = -P ]]
then
type=postpattern
else
case "$type" in
(pattern) if [[ $1 = (#b)(*)=(*) ]]
then
_patcomps[$match[1]]="=$match[2]=$func"
else
_patcomps[$1]="$func"
fi ;;
(postpattern) if [[ $1 = (#b)(*)=(*) ]]
then
_postpatcomps[$match[1]]="=$match[2]=$func"
else
_postpatcomps[$1]="$func"
fi ;;
(*) if [[ "$1" = *\=* ]]
then
cmd="${1%%\=*}"
svc=yes
else
cmd="$1"
svc=
fi
if [[ -z "$new" || -z "${_comps[$1]}" ]]
then
_comps[$cmd]="$func"
[[ -n "$svc" ]] && _services[$cmd]="${1#*\=}"
fi ;;
esac
fi
shift
done ;;
esac
else
case "$type" in
(pattern) unset "_patcomps[$^#]" ;;
(postpattern) unset "_postpatcomps[$^#]" ;;
(key) print -u2 "$0: cannot restore key bindings"
return 1 ;;
(*) unset "_comps[$^#]" ;;
esac
fi
}
typeset _i_wdirs _i_wfiles
_i_wdirs=()
_i_wfiles=()
autoload -Uz compaudit
if [[ -n "$_i_check" ]]
then
typeset _i_q
if ! eval compaudit
then
if [[ -n "$_i_q" ]]
then
if [[ "$_i_fail" = ask ]]
then
if ! read -q "?zsh compinit: insecure $_i_q, run compaudit for list.
Ignore insecure $_i_q and continue [y] or abort compinit [n]? "
then
print -u2 "$0: initialization aborted"
unfunction compinit compdef
unset _comp_dumpfile _comp_secure compprefuncs comppostfuncs _comps _patcomps _postpatcomps _compautos _lastcomp
return 1
fi
_i_wfiles=()
_i_wdirs=()
else
(( $#_i_wfiles )) && _i_files=("${(#)_i_files:#(${(j:|:)_i_wfiles%.zwc})}")
(( $#_i_wdirs )) && _i_files=("${(#)_i_files:#(${(j:|:)_i_wdirs%.zwc})/*}")
fi
fi
typeset -g _comp_secure=yes
fi
fi
autoload -Uz compdump compinstall
_i_done=''
if [[ -f "$_comp_dumpfile" ]]
then
if [[ -n "$_i_check" ]]
then
IFS=$' \t' read -rA _i_line < "$_comp_dumpfile"
if [[ _i_autodump -eq 1 && $_i_line[2] -eq $#_i_files && $ZSH_VERSION = $_i_line[4] ]]
then
builtin . "$_comp_dumpfile"
_i_done=yes
fi
else
builtin . "$_comp_dumpfile"
_i_done=yes
fi
fi
if [[ -z "$_i_done" ]]
then
typeset -A _i_test
for _i_dir in $fpath
do
[[ $_i_dir = . ]] && continue
(( $_i_wdirs[(I)$_i_dir] )) && continue
for _i_file in $_i_dir/^([^_]*|*~|*.zwc)(N)
do
_i_name="${_i_file:t}"
(( $+_i_test[$_i_name] + $_i_wfiles[(I)$_i_file] )) && continue
_i_test[$_i_name]=yes
IFS=$' \t' read -rA _i_line < $_i_file
_i_tag=$_i_line[1]
shift _i_line
case $_i_tag in
(\#compdef) if [[ $_i_line[1] = -[pPkK](n|) ]]
then
compdef ${_i_line[1]}na "${_i_name}" "${(#)_i_line[2,-1]}"
else
compdef -na "${_i_name}" "${_i_line[#]}"
fi ;;
(\#autoload) autoload -Uz "$_i_line[#]" ${_i_name}
[[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line" ;;
esac
done
done
if [[ $_i_autodump = 1 ]]
then
compdump
fi
fi
for _i_line in complete-word delete-char-or-list expand-or-complete expand-or-complete-prefix list-choices menu-complete menu-expand-or-complete reverse-menu-complete
do
zle -C $_i_line .$_i_line _main_complete
done
zle -la menu-select && zle -C menu-select .menu-select _main_complete
bindkey '^i' | IFS=$' \t' read -A _i_line
if [[ ${_i_line[2]} = expand-or-complete ]] && zstyle -a ':completion:' completer _i_line && (( ${_i_line[(i)_expand]} <= ${#_i_line} ))
then
bindkey '^i' complete-word
fi
unfunction compinit compaudit
autoload -Uz compinit compaudit
return 0
}
compinstall () {
# undefined
builtin autoload -XUz
}
is-at-least () {
emulate -L zsh
local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version order
min_ver=(${=1})
version=(${=2:-$ZSH_VERSION} 0)
while (( $min_cnt <= ${#min_ver} ))
do
while [[ "$part" != <-> ]]
do
(( ++ver_cnt > ${#version} )) && return 0
if [[ ${version[ver_cnt]} = *[0-9][^0-9]* ]]
then
order=(${version[ver_cnt]} ${min_ver[ver_cnt]})
if [[ ${version[ver_cnt]} = <->* ]]
then
[[ $order != ${${(On)order}} ]] && return 1
else
[[ $order != ${${(O)order}} ]] && return 1
fi
[[ $order[1] != $order[2] ]] && return 0
fi
part=${version[ver_cnt]##*[^0-9]}
done
while true
do
(( ++min_cnt > ${#min_ver} )) && return 0
[[ ${min_ver[min_cnt]} = <-> ]] && break
done
(( part > min_ver[min_cnt] )) && return 0
(( part < min_ver[min_cnt] )) && return 1
part=''
done
}
Simple Fix: Back up your ~/.zshrc (for example, mv ~/.zshrc ~/.zshrc.bak). Then remove it using rm ~/.zshrc. Restart the terminal. This in princlpe should fix your issue.
Also, you can copy back the relevant PATH informations, etc from the backed up .zshrc if necessary.

While loop fail to read all line from file

So I got this bash script that perform a backup command from remote server, each server hostname is defined on file called /tmp/quarantine.list. The content is like this:
server1
server2
server1 and server2 is an ssh alias to my remote server, so if I need to access either of them I just run e.g. ssh server1.
I need to backup each server in /tmp/quarantine.list, so I loop each line using while loop. Here is my code.
# Reading from /tmp/quarantine.list
while IFS= read -r list; do
if [ "$list" == "server4" ]; then
users="adminjoe"
fi
tempfile="${logdir}/rsync_$list.log"
SECONDS=0
set +x
if rsync -ca --stats --info=progress2 --remove-source-files $list:/home/${users}/backup/20* $backup_location/$list >> $tempfile 2>&1; then
ssh $list "find /home/${users}/backup/20* -type d -empty -delete"
else
echo "Error while running rsync"
exit 1
fi
set -x
elapsed_time=$SECONDS
transferred_size=$(gawk 'BEGIN { FS=":" } {gsub(/^[ \t]+|[ \t]+$/, "", $2)} /Total transferred file size/ { print $2 }' $tempfile | tr -cd "[:digit:]")
echo "Backup of $list done at $(/bin/date +'%Y-%m-%d_%H:%M:%S') --> $(bytesToHumanReadable $transferred_size)" | tee -a "${HOME}/backup.log"
echo "<b>$list --> $(bytesToHumanReadable $transferred_size)</b>" >> $konten
echo "$transferred_size $list" >> $summaryfile_size
echo "$elapsed_time $list" >> $summaryfile_time
done < "/tmp/quarantine.list"
rm "/tmp/quarantine.list"
The problem is my script only pick the first line of /tmp/quarantine.list, so for example if there was two remote in quarantine.
server2
server6
The script only process server2, while server6 remains untouched. What's weird is, when I put --dry-run option to rsync, it will process all line in /tmp/quarantine.list without problem !
Without --dry-run
+ echo 'Backup of server2 done at 2021-10-28_16:55:26 --> 3.28 GB'
Backup of server2 done at 2021-10-28_16:55:26 --> 3.28 GB
++ bytesToHumanReadable 3280769140
++ S=("bytes" "kB" "MB" "GB" "TB" "PB" "EB" "YB" "ZB")
++ local i=3280769140 d= s=0 S
++ (( i > 1000 && s < 9-1 ))
++ printf -v d .%02d 14
++ i=3280769
++ s=1
++ (( i > 1000 && s < 9-1 ))
++ printf -v d .%02d 76
++ i=3280
++ s=2
++ (( i > 1000 && s < 9-1 ))
++ printf -v d .%02d 28
++ i=3
++ s=3
++ (( i > 1000 && s < 9-1 ))
++ echo '3.28 GB'
+ echo '<b>server2 --> 3.28 GB</b>'
+ echo '3280769140 server2'
+ echo '1883 server2'
+ IFS=
+ read -r list
+ rm /tmp/quarantine.list
With --dry-run
+ echo 'Backup of server2 done at 2021-10-28_16:07:14 --> 3.28 GB'
Backup of server2 done at 2021-10-28_16:07:14 --> 3.28 GB
++ bytesToHumanReadable 3280769140
++ S=("bytes" "kB" "MB" "GB" "TB" "PB" "EB" "YB" "ZB")
++ local i=3280769140 d= s=0 S
++ (( i > 1000 && s < 9-1 ))
++ printf -v d .%02d 14
++ i=3280769
++ s=1
++ (( i > 1000 && s < 9-1 ))
++ printf -v d .%02d 76
++ i=3280
++ s=2
++ (( i > 1000 && s < 9-1 ))
++ printf -v d .%02d 28
++ i=3
++ s=3
++ (( i > 1000 && s < 9-1 ))
++ echo '3.28 GB'
+ echo '<b>server2 --> 3.28 GB</b>'
+ echo '3280769140 server2'
+ echo '32 server2'
+ IFS=
+ read -r list
+ '[' server6 == server4 ']'
As you can see, the latter continues with server6 as opposed of the former. I just wondering what I'd do wrong here?
This can happen if the last line of the file does not end with a newline. Then read will actually read the line, but it will return a non-zero status (ref: https://www.gnu.org/software/bash/manual/bash.html#index-read). This non-zero status causes the while loop to end.
The idiomatic way to handle this is:
while IFS= read -r list || [[ -n $list ]]; do

git-bash on windows returns logging

When running commands in git bash, a lot of extra info is added to the terminal. Why is this and how do I turn this off? Example below of output when enter is pressed:
++ __git_ps1
++ local exit=0
++ local pcmode=no
++ local detached=no
++ local 'ps1pc_start=\u#\h:\w '
++ local 'ps1pc_end=\$ '
++ local 'printf_format= (%s)'
++ case "$#" in
++ printf_format=' (%s)'
++ local ps1_expanded=yes
++ '[' -z '' ']'
++ '[' -z '4.4.12(1)-release' ']'
++ shopt -q promptvars
++ local repo_info rev_parse_exit_code
+++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
++ repo_info=
++ rev_parse_exit_code=128
++ '[' -z '' ']'
++ return 0

Oh-My-Zsh completion not working

I reinstalled my computer running macOS Sierra and also reinstalled oh-my-zsh. I copied over my old zshrc, which was working fine (and is still working fine on another computer).
However, every start of the zsh, the following output emerges, before the shell starts up:
bracketed-paste-magic () {
# undefined
builtin autoload -XUz
}
colors () {
emulate -L zsh
typeset -Ag color colour
color=(00 none 01 bold 02 faint 22 normal 03 standout 23 no-standout 04 underline 24 no-underline 05 blink 25 no-blink 07 reverse 27 no-reverse 08 conceal 28 no-conceal 30 black 40 bg-black 31 red 41 bg-red 32 green 42 bg-green 33 yellow 43 bg-yellow 34 blue 44 bg-blue 35 magenta 45 bg-magenta 36 cyan 46 bg-cyan 37 white 47 bg-white 39 default 49 bg-default)
local k
for k in ${(k)color}
do
color[${color[$k]}]=$k
done
for k in ${color[(I)3?]}
do
color[fg-${color[$k]}]=$k
done
color[grey]=${color[black]}
color[fg-grey]=${color[grey]}
color[bg-grey]=${color[bg-black]}
colour=(${(kv)color})
local lc=$'\e[' rc=m
typeset -Hg reset_color bold_color
reset_color="$lc${color[none]}$rc"
bold_color="$lc${color[bold]}$rc"
typeset -AHg fg fg_bold fg_no_bold
for k in ${(k)color[(I)fg-*]}
do
fg[${k#fg-}]="$lc${color[$k]}$rc"
fg_bold[${k#fg-}]="$lc${color[bold]};${color[$k]}$rc"
fg_no_bold[${k#fg-}]="$lc${color[normal]};${color[$k]}$rc"
done
typeset -AHg bg bg_bold bg_no_bold
for k in ${(k)color[(I)bg-*]}
do
bg[${k#bg-}]="$lc${color[$k]}$rc"
bg_bold[${k#bg-}]="$lc${color[bold]};${color[$k]}$rc"
bg_no_bold[${k#bg-}]="$lc${color[normal]};${color[$k]}$rc"
done
}
compdump () {
# undefined
builtin autoload -XUz
}
compinit () {
emulate -L zsh
setopt extendedglob
typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1
typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name
while [[ $# -gt 0 && $1 = -[dDiuC] ]]
do
case "$1" in
(-d) _i_autodump=1
shift
if [[ $# -gt 0 && "$1" != -[dfQC] ]]
then
_i_dumpfile="$1"
shift
fi ;;
(-D) _i_autodump=0
shift ;;
(-i) _i_fail=ign
shift ;;
(-u) _i_fail=use
shift ;;
(-C) _i_check=
shift ;;
esac
done
typeset -gHA _comps _services _patcomps _postpatcomps
typeset -gHA _compautos
typeset -gHA _lastcomp
if [[ -n $_i_dumpfile ]]
then
typeset -g _comp_dumpfile="$_i_dumpfile"
else
typeset -g _comp_dumpfile="${ZDOTDIR:-$HOME}/.zcompdump"
fi
typeset -gHa _comp_options
_comp_options=(bareglobqual extendedglob glob multibyte multifuncdef nullglob rcexpandparam unset NO_allexport NO_aliases NO_cshnullglob NO_cshjunkiequotes NO_errexit NO_globassign NO_globsubst NO_histsubstpattern NO_ignorebraces NO_ignoreclosebraces NO_kshglob NO_ksharrays NO_kshtypeset NO_markdirs NO_octalzeroes NO_posixbuiltins NO_shwordsplit NO_shglob NO_warncreateglobal)
typeset -gH _comp_setup='local -A _comp_caller_options;
_comp_caller_options=(${(kv)options[#]});
setopt localoptions localtraps localpatterns ${_comp_options[#]};
local IFS=$'\'\ \\t\\r\\n\\0\'';
builtin enable -p \| \~ \( \? \* \[ \< \^ \# 2>/dev/null;
exec </dev/null;
trap - ZERR;
local -a reply;
local REPLY'
typeset -ga compprefuncs comppostfuncs
compprefuncs=()
comppostfuncs=()
: $funcstack
compdef () {
local opt autol type func delete eval new i ret=0 cmd svc
local -a match mbegin mend
emulate -L zsh
setopt extendedglob
if (( ! $# ))
then
print -u2 "$0: I need arguments"
return 1
fi
while getopts "anpPkKde" opt
do
case "$opt" in
(a) autol=yes ;;
(n) new=yes ;;
([pPkK]) if [[ -n "$type" ]]
then
print -u2 "$0: type already set to $type"
return 1
fi
if [[ "$opt" = p ]]
then
type=pattern
elif [[ "$opt" = P ]]
then
type=postpattern
elif [[ "$opt" = K ]]
then
type=widgetkey
else
type=key
fi ;;
(d) delete=yes ;;
(e) eval=yes ;;
esac
done
shift OPTIND-1
if (( ! $# ))
then
print -u2 "$0: I need arguments"
return 1
fi
if [[ -z "$delete" ]]
then
if [[ -z "$eval" ]] && [[ "$1" = *\=* ]]
then
while (( $# ))
do
if [[ "$1" = *\=* ]]
then
cmd="${1%%\=*}"
svc="${1#*\=}"
func="$_comps[${_services[(r)$svc]:-$svc}]"
[[ -n ${_services[$svc]} ]] && svc=${_services[$svc]}
[[ -z "$func" ]] && func="${${_patcomps[(K)$svc][1]}:-${_postpatcomps[(K)$svc][1]}}"
if [[ -n "$func" ]]
then
_comps[$cmd]="$func"
_services[$cmd]="$svc"
else
print -u2 "$0: unknown command or service: $svc"
ret=1
fi
else
print -u2 "$0: invalid argument: $1"
ret=1
fi
shift
done
return ret
fi
func="$1"
[[ -n "$autol" ]] && autoload -Uz "$func"
shift
case "$type" in
(widgetkey) while [[ -n $1 ]]
do
if [[ $# -lt 3 ]]
then
print -u2 "$0: compdef -K requires <widget> <comp-widget> <key>"
return 1
fi
[[ $1 = _* ]] || 1="_$1"
[[ $2 = .* ]] || 2=".$2"
[[ $2 = .menu-select ]] && zmodload -i zsh/complist
zle -C "$1" "$2" "$func"
if [[ -n $new ]]
then
bindkey "$3" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] && bindkey "$3" "$1"
else
bindkey "$3" "$1"
fi
shift 3
done ;;
(key) if [[ $# -lt 2 ]]
then
print -u2 "$0: missing keys"
return 1
fi
if [[ $1 = .* ]]
then
[[ $1 = .menu-select ]] && zmodload -i zsh/complist
zle -C "$func" "$1" "$func"
else
[[ $1 = menu-select ]] && zmodload -i zsh/complist
zle -C "$func" ".$1" "$func"
fi
shift
for i
do
if [[ -n $new ]]
then
bindkey "$i" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] || continue
fi
bindkey "$i" "$func"
done ;;
(*) while (( $# ))
do
if [[ "$1" = -N ]]
then
type=normal
elif [[ "$1" = -p ]]
then
type=pattern
elif [[ "$1" = -P ]]
then
type=postpattern
else
case "$type" in
(pattern) if [[ $1 = (#b)(*)=(*) ]]
then
_patcomps[$match[1]]="=$match[2]=$func"
else
_patcomps[$1]="$func"
fi ;;
(postpattern) if [[ $1 = (#b)(*)=(*) ]]
then
_postpatcomps[$match[1]]="=$match[2]=$func"
else
_postpatcomps[$1]="$func"
fi ;;
(*) if [[ "$1" = *\=* ]]
then
cmd="${1%%\=*}"
svc=yes
else
cmd="$1"
svc=
fi
if [[ -z "$new" || -z "${_comps[$1]}" ]]
then
_comps[$cmd]="$func"
[[ -n "$svc" ]] && _services[$cmd]="${1#*\=}"
fi ;;
esac
fi
shift
done ;;
esac
else
case "$type" in
(pattern) unset "_patcomps[$^#]" ;;
(postpattern) unset "_postpatcomps[$^#]" ;;
(key) print -u2 "$0: cannot restore key bindings"
return 1 ;;
(*) unset "_comps[$^#]" ;;
esac
fi
}
typeset _i_wdirs _i_wfiles
_i_wdirs=()
_i_wfiles=()
autoload -Uz compaudit
if [[ -n "$_i_check" ]]
then
typeset _i_q
if ! eval compaudit
then
if [[ -n "$_i_q" ]]
then
if [[ "$_i_fail" = ask ]]
then
if ! read -q "?zsh compinit: insecure $_i_q, run compaudit for list.
Ignore insecure $_i_q and continue [y] or abort compinit [n]? "
then
print -u2 "$0: initialization aborted"
unfunction compinit compdef
unset _comp_dumpfile _comp_secure compprefuncs comppostfuncs _comps _patcomps _postpatcomps _compautos _lastcomp
return 1
fi
_i_wfiles=()
_i_wdirs=()
else
(( $#_i_wfiles )) && _i_files=("${(#)_i_files:#(${(j:|:)_i_wfiles%.zwc})}")
(( $#_i_wdirs )) && _i_files=("${(#)_i_files:#(${(j:|:)_i_wdirs%.zwc})/*}")
fi
fi
typeset -g _comp_secure=yes
fi
fi
autoload -Uz compdump compinstall
_i_done=''
if [[ -f "$_comp_dumpfile" ]]
then
if [[ -n "$_i_check" ]]
then
IFS=$' \t' read -rA _i_line < "$_comp_dumpfile"
if [[ _i_autodump -eq 1 && $_i_line[2] -eq $#_i_files && $ZSH_VERSION = $_i_line[4] ]]
then
builtin . "$_comp_dumpfile"
_i_done=yes
fi
else
builtin . "$_comp_dumpfile"
_i_done=yes
fi
fi
if [[ -z "$_i_done" ]]
then
typeset -A _i_test
for _i_dir in $fpath
do
[[ $_i_dir = . ]] && continue
(( $_i_wdirs[(I)$_i_dir] )) && continue
for _i_file in $_i_dir/^([^_]*|*~|*.zwc)(N)
do
_i_name="${_i_file:t}"
(( $+_i_test[$_i_name] + $_i_wfiles[(I)$_i_file] )) && continue
_i_test[$_i_name]=yes
IFS=$' \t' read -rA _i_line < $_i_file
_i_tag=$_i_line[1]
shift _i_line
case $_i_tag in
(\#compdef) if [[ $_i_line[1] = -[pPkK](n|) ]]
then
compdef ${_i_line[1]}na "${_i_name}" "${(#)_i_line[2,-1]}"
else
compdef -na "${_i_name}" "${_i_line[#]}"
fi ;;
(\#autoload) autoload -Uz "$_i_line[#]" ${_i_name}
[[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line" ;;
esac
done
done
if [[ $_i_autodump = 1 ]]
then
compdump
fi
fi
for _i_line in complete-word delete-char-or-list expand-or-complete expand-or-complete-prefix list-choices menu-complete menu-expand-or-complete reverse-menu-complete
do
zle -C $_i_line .$_i_line _main_complete
done
zle -la menu-select && zle -C menu-select .menu-select _main_complete
bindkey '^i' | IFS=$' \t' read -A _i_line
if [[ ${_i_line[2]} = expand-or-complete ]] && zstyle -a ':completion:' completer _i_line && (( ${_i_line[(i)_expand]} <= ${#_i_line} ))
then
bindkey '^i' complete-word
fi
unfunction compinit compaudit
autoload -Uz compinit compaudit
return 0
}
compinstall () {
# undefined
builtin autoload -XUz
}
down-line-or-beginning-search () {
# undefined
builtin autoload -XU
}
edit-command-line () {
# undefined
builtin autoload -XU
}
is-at-least () {
emulate -L zsh
local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version order
min_ver=(${=1})
version=(${=2:-$ZSH_VERSION} 0)
while (( $min_cnt <= ${#min_ver} ))
do
while [[ "$part" != <-> ]]
do
(( ++ver_cnt > ${#version} )) && return 0
if [[ ${version[ver_cnt]} = *[0-9][^0-9]* ]]
then
order=(${version[ver_cnt]} ${min_ver[ver_cnt]})
if [[ ${version[ver_cnt]} = <->* ]]
then
[[ $order != ${${(On)order}} ]] && return 1
else
[[ $order != ${${(O)order}} ]] && return 1
fi
[[ $order[1] != $order[2] ]] && return 0
fi
part=${version[ver_cnt]##*[^0-9]}
done
while true
do
(( ++min_cnt > ${#min_ver} )) && return 0
[[ ${min_ver[min_cnt]} = <-> ]] && break
done
(( part > min_ver[min_cnt] )) && return 0
(( part < min_ver[min_cnt] )) && return 1
part=''
done
}
up-line-or-beginning-search () {
# undefined
builtin autoload -XU
}
url-quote-magic () {
# undefined
builtin autoload -XUz
}
It seems some kind of script is written to stdout, instead of executed. However, I cannot find what the problem is. It might have something to do with completion, as the completion is not working.
Does anyone has any suggestion what the problem might be or where I should look next?
I was facing the same issue.
Re-installing Homebrew fixed the problem.
You have to change the default shell to zsh.
chsh -s /bin/zsh

syntax error I get overtime I open terminal [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
When I open terminal I get this error
Is it harming something? How can I fix and get rid of it ?
Last login: Mon Aug 15 11:44:29 on ttys000
-bash: eval: line 33: syntax error: unexpected end of file
As it is suggested by the answer below I should set -x and here is what I did I did set -x
Admins-MBP:~ admin$ set -x
+ set -x
++ update_terminal_cwd
++ local url_path=
++ local i ch hexch LC_CTYPE=C LC_ALL=
++ (( i = 0 ))
++ (( i < 12 ))
++ ch=/
++ [[ / =~ [/._~A-Za-z0-9-] ]]
++ url_path+=/
++ (( ++i ))
++ (( i < 12 ))
++ ch=U
++ [[ U =~ [/._~A-Za-z0-9-] ]]
++ url_path+=U
++ (( ++i ))
++ (( i < 12 ))
++ ch=s
++ [[ s =~ [/._~A-Za-z0-9-] ]]
++ url_path+=s
++ (( ++i ))
++ (( i < 12 ))
++ ch=e
++ [[ e =~ [/._~A-Za-z0-9-] ]]
++ url_path+=e
++ (( ++i ))
++ (( i < 12 ))
++ ch=r
++ [[ r =~ [/._~A-Za-z0-9-] ]]
++ url_path+=r
++ (( ++i ))
++ (( i < 12 ))
++ ch=s
++ [[ s =~ [/._~A-Za-z0-9-] ]]
++ url_path+=s
++ (( ++i ))
++ (( i < 12 ))
++ ch=/
++ [[ / =~ [/._~A-Za-z0-9-] ]]
++ url_path+=/
++ (( ++i ))
++ (( i < 12 ))
++ ch=a
++ [[ a =~ [/._~A-Za-z0-9-] ]]
++ url_path+=a
++ (( ++i ))
++ (( i < 12 ))
++ ch=d
++ [[ d =~ [/._~A-Za-z0-9-] ]]
++ url_path+=d
++ (( ++i ))
++ (( i < 12 ))
++ ch=m
++ [[ m =~ [/._~A-Za-z0-9-] ]]
++ url_path+=m
++ (( ++i ))
++ (( i < 12 ))
++ ch=i
++ [[ i =~ [/._~A-Za-z0-9-] ]]
++ url_path+=i
++ (( ++i ))
++ (( i < 12 ))
++ ch=n
++ [[ n =~ [/._~A-Za-z0-9-] ]]
++ url_path+=n
++ (( ++i ))
++ (( i < 12 ))
++ printf '\e]7;%s\a' file://Admins-MBP/Users/admin
then i did
Admins-MBP:~ admin$ . .bash_profile
+ . .bash_profile
++ '[' -r /Users/admin/.bashrc ']'
++ source /Users/admin/.bashrc
+++ source /Users/admin/perl5/perlbrew/etc/bashrc
++++ export PERLBREW_BASHRC_VERSION=0.76
++++ PERLBREW_BASHRC_VERSION=0.76
++++ export PERLBREW_ROOT=/Users/admin/perl5/perlbrew
++++ PERLBREW_ROOT=/Users/admin/perl5/perlbrew
++++ [[ -z /Users/admin/perl5/perlbrew ]]
++++ [[ -z /Users/admin/.perlbrew ]]
++++ [[ ! -n '' ]]
++++ [[ -f /Users/admin/.perlbrew/init ]]
++++ . /Users/admin/.perlbrew/init
+++++ export PERLBREW_MANPATH=/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man
+++++ PERLBREW_MANPATH=/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man
+++++ export PERLBREW_PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin
+++++ PERLBREW_PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin
+++++ export PERLBREW_PERL=perl-5.16.0
+++++ PERLBREW_PERL=perl-5.16.0
+++++ export PERLBREW_ROOT=/Users/admin/perl5/perlbrew
+++++ PERLBREW_ROOT=/Users/admin/perl5/perlbrew
+++++ export PERLBREW_VERSION=0.74
+++++ PERLBREW_VERSION=0.74
++++ perlbrew_bin_path=/Users/admin/perl5/perlbrew/bin
++++ [[ -f /Users/admin/perl5/perlbrew/bin/perlbrew ]]
++++ perlbrew_command=/Users/admin/perl5/perlbrew/bin/perlbrew
++++ unset perlbrew_bin_path
++++ __perlbrew_activate
+++++ alias perl
++++ [[ -n '' ]]
++++ [[ -n perl-5.16.0 ]]
++++ __perlbrew_set_env perl-5.16.0
++++ local code
+++++ /Users/admin/perl5/perlbrew/bin/perlbrew env perl-5.16.0
++++ code='export PERLBREW_MANPATH="/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man"
export PERLBREW_PATH="/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin"
export PERLBREW_PERL="perl-5.16.0"
export PERLBREW_ROOT="/Users/admin/perl5/perlbrew"
export PERLBREW_VERSION="0.76"'
++++ eval 'export PERLBREW_MANPATH="/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man"
export PERLBREW_PATH="/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin"
export PERLBREW_PERL="perl-5.16.0"
export PERLBREW_ROOT="/Users/admin/perl5/perlbrew"
export PERLBREW_VERSION="0.76"'
+++++ export PERLBREW_MANPATH=/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man
+++++ PERLBREW_MANPATH=/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man
+++++ export PERLBREW_PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin
+++++ PERLBREW_PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin
+++++ export PERLBREW_PERL=perl-5.16.0
+++++ PERLBREW_PERL=perl-5.16.0
+++++ export PERLBREW_ROOT=/Users/admin/perl5/perlbrew
+++++ PERLBREW_ROOT=/Users/admin/perl5/perlbrew
+++++ export PERLBREW_VERSION=0.76
+++++ PERLBREW_VERSION=0.76
++++ __perlbrew_set_path
++++++ manpath
+++++ __perlbrew_purify /Users/admin/perl5/perlbrew/perls/perl-5.16.0/man:/usr/local/share/man:/usr/share/man:/opt/X11/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
+++++ local path patharray outsep
+++++ IFS=:
+++++ read -ra patharray
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s /usr/local/share/man
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/usr/share/man
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/opt/X11/share/man
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/Applications/Xcode.app/Contents/Developer/usr/share/man
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
+++++ outsep=:
++++ export MANPATH=/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man:/usr/local/share/man:/usr/share/man:/opt/X11/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
++++ MANPATH=/Users/admin/perl5/perlbrew/perls/perl-5.16.0/man:/usr/local/share/man:/usr/share/man:/opt/X11/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
+++++ __perlbrew_purify /Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin
+++++ local path patharray outsep
+++++ IFS=:
+++++ read -ra patharray
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s /Users/admin/.rbenv/shims
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/opt/local/bin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/opt/local/sbin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/usr/local/bin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/usr/bin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/bin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/usr/sbin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/sbin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/opt/X11/bin
+++++ outsep=:
+++++ for path in '"${patharray[#]}"'
+++++ case "$path" in
+++++ printf %s :/Users/admin/.rvm/bin
+++++ outsep=:
++++ export PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin
++++ PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin
++++ hash -r
+++ export PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin:/Users/admin/.rvm/bin
+++ PATH=/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin:/Users/admin/.rvm/bin
++ export PATH=/opt/local/bin:/opt/local/sbin:/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin:/Users/admin/.rvm/bin
++ PATH=/opt/local/bin:/opt/local/sbin:/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin:/Users/admin/.rvm/bin
+++ rbenv init -
++ eval 'export PATH="/Users/admin/.rbenv/shims:${PATH}"
export RBENV_SHELL=bash
source '\''/usr/local/Cellar/rbenv/1.0.0/libexec/../completions/rbenv.bash'\''
command rbenv rehash 2>/dev/null
rbenv() {
local command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "$(rbenv "sh-$command" "$#")";;
*)
command rbenv "$command" "$#";;
esac
}source' /Users/admin/perl5/perlbrew/etc/bashrc
+++ export PATH=/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin:/Users/admin/.rvm/bin
+++ PATH=/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/Users/admin/perl5/perlbrew/bin:/Users/admin/perl5/perlbrew/perls/perl-5.16.0/bin:/Users/admin/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/admin/.rvm/bin:/Users/admin/.rvm/bin
+++ export RBENV_SHELL=bash
+++ RBENV_SHELL=bash
+++ source /usr/local/Cellar/rbenv/1.0.0/libexec/../completions/rbenv.bash
++++ complete -F _rbenv rbenv
+++ command rbenv rehash
-bash: eval: line 33: syntax error: unexpected end of file
++ update_terminal_cwd
++ local url_path=
++ local i ch hexch LC_CTYPE=C LC_ALL=
++ (( i = 0 ))
++ (( i < 12 ))
++ ch=/
++ [[ / =~ [/._~A-Za-z0-9-] ]]
++ url_path+=/
++ (( ++i ))
++ (( i < 12 ))
++ ch=U
++ [[ U =~ [/._~A-Za-z0-9-] ]]
++ url_path+=U
++ (( ++i ))
++ (( i < 12 ))
++ ch=s
++ [[ s =~ [/._~A-Za-z0-9-] ]]
++ url_path+=s
++ (( ++i ))
++ (( i < 12 ))
++ ch=e
++ [[ e =~ [/._~A-Za-z0-9-] ]]
++ url_path+=e
++ (( ++i ))
++ (( i < 12 ))
++ ch=r
++ [[ r =~ [/._~A-Za-z0-9-] ]]
++ url_path+=r
++ (( ++i ))
++ (( i < 12 ))
++ ch=s
++ [[ s =~ [/._~A-Za-z0-9-] ]]
++ url_path+=s
++ (( ++i ))
++ (( i < 12 ))
++ ch=/
++ [[ / =~ [/._~A-Za-z0-9-] ]]
++ url_path+=/
++ (( ++i ))
++ (( i < 12 ))
++ ch=a
++ [[ a =~ [/._~A-Za-z0-9-] ]]
++ url_path+=a
++ (( ++i ))
++ (( i < 12 ))
++ ch=d
++ [[ d =~ [/._~A-Za-z0-9-] ]]
++ url_path+=d
++ (( ++i ))
++ (( i < 12 ))
++ ch=m
++ [[ m =~ [/._~A-Za-z0-9-] ]]
++ url_path+=m
++ (( ++i ))
++ (( i < 12 ))
++ ch=i
++ [[ i =~ [/._~A-Za-z0-9-] ]]
++ url_path+=i
++ (( ++i ))
++ (( i < 12 ))
++ ch=n
++ [[ n =~ [/._~A-Za-z0-9-] ]]
++ url_path+=n
++ (( ++i ))
++ (( i < 12 ))
++ printf '\e]7;%s\a' file://Admins-MBP/Users/admin
Admins-MBP:~ admin$
It's most likely coming from your .bashrc or .bashprofile.
You can try to diagnose the root cause by first using set -x, this will cause your shell to trace all the commands being executed. Then you can source the files again by doing . .bashrc and . bash_profile and see what's going on.

Resources