I've recently installed the libvips (https://www.libvips.org/install.html) image processing library and this has caused some conflicts running Jekyll on my local environment. The installation had rbenv upgraded from version 1.1.2 to 1.2.0.
The error I'm getting is:
/Users/gschiavon/.rbenv/shims/jekyll: line 21: /opt/homebrew/Cellar/rbenv/1.1.2/libexec/rbenv: No such file or directory
My rbenv.log file:
+(/opt/homebrew/bin/rbenv:23): enable -f /opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-realpath.dylib realpath
+(/opt/homebrew/bin/rbenv:54): '[' -z '' ']'
+(/opt/homebrew/bin/rbenv:55): RBENV_ROOT=/Users/gschiavon/.rbenv
+(/opt/homebrew/bin/rbenv:59): export RBENV_ROOT
+(/opt/homebrew/bin/rbenv:61): '[' -z '' ']'
+(/opt/homebrew/bin/rbenv:62): RBENV_DIR=/Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell
+(/opt/homebrew/bin/rbenv:69): export RBENV_DIR
+(/opt/homebrew/bin/rbenv:71): '[' -n '' ']'
+(/opt/homebrew/bin/rbenv:71): export RBENV_ORIG_PATH=/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/Users/gschiavon/.gem/ruby/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin
+(/opt/homebrew/bin/rbenv:71): RBENV_ORIG_PATH=/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/Users/gschiavon/.gem/ruby/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin
+(/opt/homebrew/bin/rbenv:73): shopt -s nullglob
++(/opt/homebrew/bin/rbenv:75): abs_dirname /opt/homebrew/bin/rbenv
++(/opt/homebrew/bin/rbenv:25): abs_dirname(): local path
+++(/opt/homebrew/bin/rbenv:26): abs_dirname(): realpath /opt/homebrew/bin/rbenv
++(/opt/homebrew/bin/rbenv:26): abs_dirname(): path=/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv
++(/opt/homebrew/bin/rbenv:27): abs_dirname(): echo /opt/homebrew/Cellar/rbenv/1.2.0/libexec
+(/opt/homebrew/bin/rbenv:75): bin_path=/opt/homebrew/Cellar/rbenv/1.2.0/libexec
+(/opt/homebrew/bin/rbenv:79): export PATH=/opt/homebrew/Cellar/rbenv/1.2.0/libexec:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/Users/gschiavon/.gem/ruby/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin
+(/opt/homebrew/bin/rbenv:79): PATH=/opt/homebrew/Cellar/rbenv/1.2.0/libexec:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/Users/gschiavon/.gem/ruby/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/gschiavon/.gem/ruby/3.0.0/bin:/Users/gschiavon/.rbenv/shims:/opt/homebrew/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin
+(/opt/homebrew/bin/rbenv:81): RBENV_HOOK_PATH=:/Users/gschiavon/.rbenv/rbenv.d
+(/opt/homebrew/bin/rbenv:82): '[' /opt/homebrew/Cellar/rbenv/1.2.0 '!=' /Users/gschiavon/.rbenv ']'
+(/opt/homebrew/bin/rbenv:84): RBENV_HOOK_PATH=:/Users/gschiavon/.rbenv/rbenv.d:/opt/homebrew/Cellar/rbenv/1.2.0/rbenv.d
+(/opt/homebrew/bin/rbenv:86): RBENV_HOOK_PATH=:/Users/gschiavon/.rbenv/rbenv.d:/opt/homebrew/Cellar/rbenv/1.2.0/rbenv.d:/opt/homebrew/etc/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks
+(/opt/homebrew/bin/rbenv:90): RBENV_HOOK_PATH=/Users/gschiavon/.rbenv/rbenv.d:/opt/homebrew/Cellar/rbenv/1.2.0/rbenv.d:/opt/homebrew/etc/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks
+(/opt/homebrew/bin/rbenv:91): export RBENV_HOOK_PATH
+(/opt/homebrew/bin/rbenv:93): shopt -u nullglob
+(/opt/homebrew/bin/rbenv:96): command=version
+(/opt/homebrew/bin/rbenv:97): case "$command" in
++(/opt/homebrew/bin/rbenv:110): command -v rbenv-version
+(/opt/homebrew/bin/rbenv:110): command_path=/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version
+(/opt/homebrew/bin/rbenv:111): '[' -z /opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version ']'
+(/opt/homebrew/bin/rbenv:119): shift 1
+(/opt/homebrew/bin/rbenv:120): '[' '' = --help ']'
+(/opt/homebrew/bin/rbenv:127): exec /opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:11): rbenv-version-name
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:6): '[' -z '' ']'
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:7): rbenv-version-file
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:7): target_dir=
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:22): '[' -n '' ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:25): find_local_version_file /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:10): find_local_version_file(): local root=/Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon/Documents/dev/sites.nosync
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents/dev/sites.nosync =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/dev/sites.nosync/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents/dev/sites.nosync ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon/Documents/dev
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents/dev =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/dev/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents/dev ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon/Documents
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ '' =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n '' ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): break
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:19): find_local_version_file(): return 1
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:26): '[' /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell '!=' /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:27): echo /Users/gschiavon/.rbenv/version
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:7): RBENV_VERSION_FILE=/Users/gschiavon/.rbenv/version
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:8): rbenv-version-file-read /Users/gschiavon/.rbenv/version
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:6): VERSION_FILE=/Users/gschiavon/.rbenv/version
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:8): '[' -e /Users/gschiavon/.rbenv/version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:10): IFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:11): words=($(cut -b 1-1024 "$VERSION_FILE"))
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:11): cut -b 1-1024 /Users/gschiavon/.rbenv/version
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:12): version=3.0.0
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:14): '[' 3.0.0 = .. ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:14): [[ 3.0.0 == */* ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:16): '[' -n 3.0.0 ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:17): echo 3.0.0
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file-read:18): exit
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:8): RBENV_VERSION=3.0.0
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:11): OLDIFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:12): IFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:12): scripts=(`rbenv-hooks version-name`)
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:12): rbenv-hooks version-name
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:9): '[' version-name = --complete ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:18): RBENV_COMMAND=version-name
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:19): '[' -z version-name ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:24): enable -f /opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-realpath.dylib realpath
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:55): IFS=:
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:55): hook_paths=($RBENV_HOOK_PATH)
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:57): shopt -s nullglob
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:63): shopt -u nullglob
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:13): IFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:18): '[' -z 3.0.0 ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:18): '[' 3.0.0 = system ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:28): version_exists 3.0.0
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:24): version_exists(): local version=3.0.0
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:25): version_exists(): '[' -d /Users/gschiavon/.rbenv/versions/3.0.0 ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-name:29): echo 3.0.0
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:11): version_name=3.0.0
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:12): rbenv-version-origin
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:6): unset RBENV_VERSION_ORIGIN
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:8): OLDIFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:9): IFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:9): scripts=(`rbenv-hooks version-origin`)
++(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:9): rbenv-hooks version-origin
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:9): '[' version-origin = --complete ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:18): RBENV_COMMAND=version-origin
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:19): '[' -z version-origin ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:24): enable -f /opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-realpath.dylib realpath
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:55): IFS=:
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:55): hook_paths=($RBENV_HOOK_PATH)
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:57): shopt -s nullglob
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:58): for path in '"${hook_paths[#]}"'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-hooks:63): shopt -u nullglob
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:10): IFS='
'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:15): '[' -n '' ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:17): '[' -n '' ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-origin:20): rbenv-version-file
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:7): target_dir=
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:22): '[' -n '' ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:25): find_local_version_file /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:10): find_local_version_file(): local root=/Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon/Documents/dev/sites.nosync
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents/dev/sites.nosync =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/dev/sites.nosync/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents/dev/sites.nosync ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon/Documents/dev
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents/dev =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/dev/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents/dev ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon/Documents
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon/Documents =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/Documents/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon/Documents ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users/gschiavon
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users/gschiavon =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/gschiavon/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users/gschiavon ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=/Users
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ /Users =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /Users/.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n /Users ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:17): find_local_version_file(): root=
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:11): find_local_version_file(): [[ '' =~ ^//[^/]*$ ]]
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:12): find_local_version_file(): '[' -s /.ruby-version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): '[' -n '' ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:16): find_local_version_file(): break
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:19): find_local_version_file(): return 1
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:26): '[' /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell '!=' /Users/gschiavon/Documents/dev/sites.nosync/kyle-campbell ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version-file:27): echo /Users/gschiavon/.rbenv/version
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:12): version_origin=/Users/gschiavon/.rbenv/version
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:14): '[' /Users/gschiavon/.rbenv/version = /Users/gschiavon/.rbenv/version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:14): '[' '!' -e /Users/gschiavon/.rbenv/version ']'
+(/opt/homebrew/Cellar/rbenv/1.2.0/libexec/rbenv-version:17): echo '3.0.0 (set by /Users/gschiavon/.rbenv/version)'
I suspect this is happening due to rbenv being updated to version 1.2.0 in the process of libvips installation.
How can I change the /opt/homebrew/Cellar/rbenv path to 1.1.2?
Related
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.
I have a folder with about 1.5 MILLION small files. I also have duplicates in the parents directories already. So it's a bit of a mess.
They all have a format which includes the date into the filename
I'm trying to sort them by year into parent folder.
This is currently what I have. But it does only about 3 a second. Is there something that does below but faster? I have SAS disks, 32GB ram and Xeon 3.2GHz. Windows 2012 r2
#!/bin/bash
for f in * ; do
if [[ $f == *_D????98* ]]
then
if ! [[ -e ../../1998/$f ]]
then
mv $f ../../1998/$f
fi
elif [[ $f == *_D????99* ]]
then
if ! [[ -e ../../1999/$f ]]
then
mv $f ../../1999/$f
fi
elif [[ $f == *_D????00* ]]
then
if ! [[ -e ../../2000/$f ]]
then
mv $f ../../2000/$f
fi
elif [[ $f == *_D????01* ]]
then
if ! [[ -e ../../2001/$f ]]
then
mv $f ../../2001/$f
fi
elif [[ $f == *_D????02* ]]
then
if ! [[ -e ../../2002/$f ]]
then
mv $f ../../2002/$f
fi
elif [[ $f == *_D????03* ]]
then
if ! [[ -e ../../2003/$f ]]
then
mv $f ../../2003/$f
fi
elif [[ $f == *_D????04* ]]
then
if ! [[ -e ../../2004/$f ]]
then
mv $f ../../2004/$f
fi
elif [[ $f == *_D????05* ]]
then
if ! [[ -e ../../2005/$f ]]
then
mv $f ../../2005/$f
fi
elif [[ $f == *_D????06* ]]
then
if ! [[ -e ../../2006/$f ]]
then
mv $f ../../2006/$f
fi
elif [[ $f == *_D????07* ]]
then
if ! [[ -e ../../2007/$f ]]
then
mv $f ../../2007/$f
fi
elif [[ $f == *_D????08* ]]
then
if ! [[ -e ../../2008/$f ]]
then
mv $f ../../2008/$f
fi
elif [[ $f == *_D????09* ]]
then
if ! [[ -e ../../2009/$f ]]
then
mv $f ../../2009/$f
fi
elif [[ $f == *_D????10* ]]
then
if ! [[ -e ../../2010/$f ]]
then
mv $f ../../2010/$f
fi
elif [[ $f == *_D????11* ]]
then
if ! [[ -e ../../2011/$f ]]
then
mv $f ../../2011/$f
fi
elif [[ $f == *_D????12* ]]
then
if ! [[ -e ../../2012/$f ]]
then
mv $f ../../2012/$f
fi
elif [[ $f == *_D????13* ]]
then
if ! [[ -e ../../2013/$f ]]
then
mv $f ../../2013/$f
fi
elif [[ $f == *_D????14* ]]
then
if ! [[ -e ../../2014/$f ]]
then
mv $f ../../2014/$f
fi
elif [[ $f == *_D????15* ]]
then
if ! [[ -e ../../2015/$f ]]
then
mv $f ../../2015/$f
fi
elif [[ $f == *_D????16* ]]
then
if ! [[ -e ../../2016/$f ]]
then
mv $f ../../2016/$f
fi
elif [[ $f == *_D????17* ]]
then
if ! [[ -e ../../2017/$f ]]
then
mv $f ../../2017/$f
fi
elif [[ $f == *_D????18* ]]
then
if ! [[ -e ../../2018/$f ]]
then
mv $f ../../2018/$f
fi
fi
done
wmic bios get serialnumber
There seems some bottleneck factors. The fragment for f in * will
create a list of all files at once and will consume some memory.
Some improvements of the posted code may be possible but we cannot expect a drastic change,
as bash is not a time-efficient language.
I'd recommend to consider other languages.
If Perl is available, please try something like:
perl -e '
opendir(D, ".") or die;
while ($f = readdir(D)) { # it reads file by file
next if $f eq "." or $f eq ".."; # skip parent dir and current dir
if ( -f $f && $f =~ /_D.{4}(\d{2})/) { # find the matching file
$yy = $1; # extract year
$year = $yy + 1900;
if ($yy < 70) {
$year += 100;
}
if (-d "../../$year" && ! -e "../../$year/$f") {
rename $f, "../../$year/$f"; # move to the desired destination
}
}
}'
In my benchmark environment, it runs 50 or 100 times faster than the posted script. Hope this helps.
I have just discovered that my OSX bash behaves like this when I type
$ cd code/hack/foo/
$ ls # empty directory
$ cd 0
$ pwd
/Users/hrvoje
$ cd -
$ pwd
/code/hack/foo
$ cd 123
$ pwd
/Users/hrvoje
My question is - why does cd 0 or cd 123 change directory to $HOME instead of displaying an error about a missing directory?
EDIT: Here is an output of set -x after running cd 123 with altered PS4.
::::+[[ exec_scmb_expand_args builtin cd 0 != '' ]]
::::+chruby_auto
::auto.sh:chruby_auto:44+local dir=/Users/hrvoje/code/hack/foo/ version
::auto.sh:chruby_auto:44+[[ -z /Users/hrvoje/code/hack/foo/ ]]
::auto.sh:chruby_auto:44+dir=/Users/hrvoje/code/hack/foo
::auto.sh:chruby_auto:44+[[ -n '' ]]
::auto.sh:chruby_auto:44+[[ -z /Users/hrvoje/code/hack/foo ]]
::auto.sh:chruby_auto:44+dir=/Users/hrvoje/code/hack
::auto.sh:chruby_auto:44+[[ -n '' ]]
::auto.sh:chruby_auto:44+[[ -z /Users/hrvoje/code/hack ]]
::auto.sh:chruby_auto:44+dir=/Users/hrvoje/code
::auto.sh:chruby_auto:44+[[ -n '' ]]
::auto.sh:chruby_auto:44+[[ -z /Users/hrvoje/code ]]
::auto.sh:chruby_auto:44+dir=/Users/hrvoje
::auto.sh:chruby_auto:44+[[ -n '' ]]
::auto.sh:chruby_auto:44+[[ -z /Users/hrvoje ]]
::auto.sh:chruby_auto:44+dir=/Users
::auto.sh:chruby_auto:44+[[ -n '' ]]
::auto.sh:chruby_auto:44+[[ -z /Users ]]
::auto.sh:chruby_auto:44+dir=
::auto.sh:chruby_auto:44+[[ -n '' ]]
::auto.sh:chruby_auto:44+[[ -z '' ]]
::auto.sh:chruby_auto:44+[[ -n '' ]]
:::+exec_scmb_expand_args builtin cd 0
::status_shortcuts.sh:exec_scmb_expand_args:44+scmb_expand_args builtin cd 0
::status_shortcuts.sh:scmb_expand_args:0+'[' builtin = --relative ']'
::status_shortcuts.sh:exec_scmb_expand_args:44+sed -e 's/\([][|;()<>^ "'\''&]\)/\\\1/g'
::status_shortcuts.sh:scmb_expand_args:0+first=1
::status_shortcuts.sh:scmb_expand_args:0+OLDIFS='
'
::status_shortcuts.sh:scmb_expand_args:0+IFS=' '
::status_shortcuts.sh:scmb_expand_args:0+for arg in "$#"
::status_shortcuts.sh:scmb_expand_args:0+[[ builtin =~ ^[0-9]{0,4}$ ]]
::status_shortcuts.sh:scmb_expand_args:0+[[ builtin =~ ^[0-9]+-[0-9]+$ ]]
::status_shortcuts.sh:scmb_expand_args:0+'[' 1 -eq 1 ']'
::status_shortcuts.sh:scmb_expand_args:0+first=0
::status_shortcuts.sh:scmb_expand_args:0+printf %s builtin
::status_shortcuts.sh:scmb_expand_args:0+for arg in "$#"
::status_shortcuts.sh:scmb_expand_args:0+[[ cd =~ ^[0-9]{0,4}$ ]]
::status_shortcuts.sh:scmb_expand_args:0+[[ cd =~ ^[0-9]+-[0-9]+$ ]]
::status_shortcuts.sh:scmb_expand_args:0+'[' 0 -eq 1 ']'
::status_shortcuts.sh:scmb_expand_args:0+printf '\t'
::status_shortcuts.sh:scmb_expand_args:0+printf %s cd
::status_shortcuts.sh:scmb_expand_args:0+for arg in "$#"
::status_shortcuts.sh:scmb_expand_args:0+[[ 0 =~ ^[0-9]{0,4}$ ]]
::status_shortcuts.sh:scmb_expand_args:0+'[' 0 -eq 1 ']'
::status_shortcuts.sh:scmb_expand_args:0+printf '\t'
::status_shortcuts.sh:scmb_expand_args:0+'[' -e 0 ']'
::status_shortcuts.sh:scmb_expand_args:0+_print_path '' e0
::status_shortcuts.sh:_print_path:16+'[' '' = 1 ']'
::status_shortcuts.sh:_print_path:16+eval printf %s '"$e0"'
:::status_shortcuts.sh:_print_path:16+printf %s ''
::status_shortcuts.sh:scmb_expand_args:0+IFS='
'
:status_shortcuts.sh:exec_scmb_expand_args:44+eval 'builtin cd '
::status_shortcuts.sh:exec_scmb_expand_args:44+builtin cd
::::+is_on_git
::.sexy_prompt:is_on_git:1+git rev-parse
::::+parse_git_branch
::repo_index.sh:parse_git_branch:1+/usr/local/bin/git branch --no-color
::repo_index.sh:parse_git_branch:1+sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
You've installed a tool called scm_breeze, which customizes how your shell behaves.
This tool supports "numbered shortcuts", and is trying to expand your value as such; the relevant code is here.
Since there is no shortcut 0 defined (which is to say, no variable named e0), the result is an empty value -- and cd with no arguments changes to the home directory.
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
I didn't know how to solve this error.
bash: /home/dery/.bashrc: line 168: syntax error: unexpected end of file
Here is my .bashrc:
case $- in
*i*) ;;
*) return;;
esac
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u#\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u#\h:\w\$ '
fi
unset color_prompt force_color_prompt
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\$(print_title)\a\]$PS1"
__el_LAST_EXECUTED_COMMAND=""
print_title ()
{
__el_FIRSTPART=""
__el_SECONDPART=""
if [ "$PWD" == "$HOME" ]; then
__el_FIRSTPART=$(gettext --domain="pantheon-files" "Home")
else
if [ "$PWD" == "/" ]; then
__el_FIRSTPART="/"
else
__el_FIRSTPART="${PWD##*/}"
fi
fi
if [[ "$__el_LAST_EXECUTED_COMMAND" == "" ]]; then
echo "$__el_FIRSTPART"
return
fi
#trim the command to the first segment and strip sudo
if [[ "$__el_LAST_EXECUTED_COMMAND" == sudo* ]]; then
__el_SECONDPART="${__el_LAST_EXECUTED_COMMAND:5}"
__el_SECONDPART="${__el_SECONDPART%% *}"
else
__el_SECONDPART="${__el_LAST_EXECUTED_COMMAND%% *}"
fi
printf "%s: %s" "$__el_FIRSTPART" "$__el_SECONDPART"
}
put_title()
{
__el_LAST_EXECUTED_COMMAND="${BASH_COMMAND}"
printf "\033]0;%s\007" "$1"
}
# Show the currently running command in the terminal title:
# http://www.davidpashley.com/articles/xterm-titles-with-bash.html
update_tab_command()
{
# catch blacklisted commands and nested escapes
case "$BASH_COMMAND" in
*\033]0*|update_*|echo*|printf*|clear*|cd*)
__el_LAST_EXECUTED_COMMAND=""
;;
*)
put_title "${BASH_COMMAND}"
;;
esac
}
preexec_functions+=(update_tab_command)
;;
*)
;;
You forgot to close your case at the end of the script with esac. This leaves an unterminated case, causing Bash to reach the end of the file looking for one, triggering this error.