${BASH_SOURCE[0]} equivalent in zsh?

${BASH_SOURCE[0]} equivalent in zsh is ${(%):-%N}, NOT $0(as OP said, the latter failed in .zshrc) Here % indicates prompt expansion on the value, %N indicates “The name of the script, sourced file, or shell function that zsh is currently executing, whichever was started most recently. If there is none, this is equivalent to the parameter … Read more

After upgrade MacOS terminal showing: zsh: command not found: flutter

You need to update the environment path. Open terminal. vim $HOME/.zshrc Press “I” key for going to insert mode. add the following line in the opened file: export PATH=”$PATH:/YOUR_FLUTTER_DIR/flutter/bin” Press “Esc” then write :wq! in terminal and press enter to exit vim. Reopen the terminal and check “flutter doctor” If this solution did not work, … Read more

Can I profile my .zshrc/.zshenv?

Try adding this at the beginning of the file: # set the trace prompt to include seconds, nanoseconds, script name and line number # This is GNU date syntax; by default Macs ship with the BSD date program, which isn’t compatible PS4=’+$(date “+%s:%N”) %N:%i> ‘ # save file stderr to file descriptor 3 and redirect … Read more

Install zsh without root access? [closed]

Download zsh with: wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download mkdir zsh && unxz zsh.tar.xz && tar -xvf zsh.tar -C zsh –strip-components 1 cd zsh You can compile zsh yourself, for example: ./configure –prefix=$HOME make make install and then start it explicitly, or programmatically from your current shell’s startup file (put exec $HOME/bin/zsh -l in the right spot).

zsh: update prompt with current time when a command is started

This is in fact possible without resorting to strange hacks. I’ve got this in my .zshrc RPROMPT='[%D{%L:%M:%S %p}]’ TMOUT=1 TRAPALRM() { zle reset-prompt } The TRAPALRM function gets called every TMOUT seconds (in this case 1), and here it performs a prompt refresh, and does so until a command starts execution (and it doesn’t interfere … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)