简体   繁体   中英

Move zsh + prezto configuration to dropbox

Many people like to move their bash profiles to a Dropbox folder so that they can have multiple machines with their same profile (usually, for those who have a custom and specific profile that they love). I would like to do the same thing with my zsh profile and Prezto framework.

I created a Dropbox folder in /Users/me/Dropbox/Computer Preferences/zsh/ (I will refer to this as DBFolder , hereon) which I would like to store my Prezto configuration in.

Here is the process that I've pursued:

  1. I downloaded Prezto and moved all the files in the download to DBFolder .
  2. I created a symlink for all z* files within {DBFolder}/.zprezto/runcoms/ The resultant symlinks live in ~/ .
  3. I added these lines to my zshenv file:

    export ZDOTDIR="$HOME/Dropbox/Computer Preferences/zsh" if [[ "$SHLVL" -eq 1 && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then source "${ZDOTDIR:-$HOME}/.zprofile" path = /Users/me/bin fi

I am now able to launch my zsh profile with Prezto configurations. However, my problem is now that my initial login fails to load the path:

/Users/me/.zshenv:22: permission denied: /Users/me/bin
$ whoami
#=> me

My questions is - Why am I unable to access /Users/me/bin when I am clearly logged in (via the $ whoami ) where it is within my home directory?

The problematic line is

path = /Users/me/bin

There are three problems:

  1. $path is an array in Zsh; $PATH is the POSIX-compatible scalar.
  2. = surrounded by spaces is a syntax error; assignment in POSIX shells should not contain spaces.
  3. $PATH should be extended rather than overwritten.

Correction:

PATH=$HOME/bin:$PATH

or

path=($HOME/bin $path)

The latter requires the ksharrays option to be off (off by default).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM