zsh continues to remove the trailing slash from the paths when I call a third-party word-replacement tool

zsh continues to remove the trailing slash from the paths when I call a third-party word-replacement tool.

How can I stop it?

For example, if I type:
cd /tmp/ and then call my text replacement app, zsh reduces my command cd /tmp, If the text substitution adds their text (eg "foo"), I have now cd /tmpfoo Instead of cd /tmp/foo,

Is there an option to disable the function to remove the trailing slashes?

Command line – MacOS zsh alias pwd is wrong

I recently switched to MacOS and some aliases in ZSH that work on a Linux system make me headache on MacOS. To be exact, pwd Variable in alias uses the same directory from which it comes. I have to provide resources .zshrc to recognize from different directories for zsh pwd right.

Here is what I mean. My content in .zshrc is:

alias myls="ls -lrth $(pwd)"

and here are the results:

~ source ~/.zshrc
~ cd ~
~ alias myls
... myls='ls -lrth /Users/myusername'

~ cd ~/Documents
~ alias myls
... myls='ls -lrth /Users/myusername' <--- It should list content for ~/Document
~ source ~/.zshrc
~ alias myls
... myls='ls -lrth /Users/myusername/Documents' <--- Sourcing again fixes it

Can someone tell me why I have my source? .zshrc to be able to use again and again $(pwd) while it works forever under Linux in a single source?

shell – Why does the interactive command abort when the zsh widget is used for execution?

Zsh version:

zsh 5.4.2 (x86_64-ubuntu-linux-gnu)

The code (two files: .zshrc and interactive, both in my home directory):

.zshrc:

source ./interactive

custom_execute(){
  echo
  exc0 $BUFFER
  BUFFER=""
  zle accept-line
}
zle -N custom_execute
bind_enter(){
  bindkey '^M' custom_execute
}

interactive:

exc0(){
  echo exc0_begin
  cmd="$@"
  eval "$cmd"
  ret=$?
  echo exc0_end
  return $ret
}

Scenario:

Run the following command to open a new shell:

exc0 sudo apt remove gparted

It does not matter which command is executed after exc0. It is important that the user enters stdin before it is finished. In my case, gparted is installed and asked if I want to remove it or not.

I'm using Ctrl + C to finish the command because I do not really want to remove gparted.
The last line is:

Do you want to continue? (Y/n) ^C%

Now I enter this command:

bind_enter

After that:

sudo apt remove gparted

The last two lines show:

Do you want to continue? (Y/n) Abort.
exc0_end

In both cases, the shell asks for my sudo password, this part works. But when it comes to confirmation, the second command aborts. Question: Why?

Zsh treats a string as a file name pattern and complains about it (NOMATCH option)

I try Zsh and come from Bash. I had a bit of trouble understanding why Zsh complained about a regular expression.

usr@rk1 ~ % tty | grep ^/dev/tty(1-7)$ > /dev/null 2>&1
zsh: no matches found: ^/dev/tty(1-7)$

I've found that the output disappears and everything is fine if (1) I put the regex in quotation marks, (2) remove the slashes from the regex, or (3) use setopt NO_NOMATCH,

From the zshoptions manual:

NOMATCH (+3)

If a pattern for filename generation does not match, print an error instead of leaving it in the argument list. This also applies to the file extension of an initial & # 39; & # 39; or & # 39; = & # 39 ;.

It seems to me that the regular expression is treated as a filename pattern due to the slashes. Is this a bug?

Where can I find the Zsh version of the GreyCat Bashisms page?

Why does rm break off in zsh?

I have a bunch of files:

> $ ls
FleurInputSchema.xsd inp.xml out usage.json
fort.77 juDFT_times.json out.xml

and I want to delete some of it, but not every file is always there. So I made an alias for

rm broyd broyd.7 cdn * * .dat * .npy stars wkf2 fleurinputschema.xsd judft_times juDFT_times.json inf out.xml usage.json struct.xsf juDFT_times FleurInputSchema.xsd mixing_history * 2> / dev / null
zsh: no matches found: cdn *

This also works on Linux with zsh. On a Mac, the rm command is not even started after the command can not be executed cdn-wildward. How do I make zsh ignore the missing files?

Command line – setting of $ 0 in the source of zsh

I am trying to create a command that behaves like a "symlink through ssh", ie. H. Calls a remote script as if called locally. My script is:

#! / bin / zsh
if (("$ #" = 0)); then
echo "Usage: $ 0 "> 2 exit 1
fi
if ! [[ "$1" =~ '^[0-9]+ $ & # 39;]]; then
Echo "Error:" $ 1 "is not a valid number"> & 2; Exit 1
fi

I use it for that <(Command), a process replacement in which a FIFO is created with a path like / proc / self / fd /redirect commandStdout and evaluate this path. fifo = <(echo & # 39; hi! & # 39;); echo $ fifo; cat $ fifo will echo / proc / self / fd / 14 (or so) and then Hello!,

So that should be the trick, let's see if the "usage" thing works. I save this script in my $ PATH and execute it with its filename exec remote,

#! / bin / zsh
source <(ssh # cat myserver: bin / mycommand #)

Nearly! This causes the remote script to say

Usage: / proc / self / fd / 12 

instead of

Usage: exec-remote 

… which means that while the remote script is being swapped $ 0 is set to the FIFO path of the process replacement.

But zsh's source Command only seems to accept positional parameters ($ @):

#! / bin / zsh
source <(ssh # cat myserver: bin / mycommand #) $ 0

… will my script say:

Error: "/ proc / self / fd / 12" is not a valid number

How can I zsh let my remote code execute on exiting? $ 0 alone?

Zsh git branch is missing on the right side of my screen

Some of your previous answers have not been well received and you run the risk of being blocked from answering.

Please note the following notes exactly:

  • Please be sure answer the question, Enter details and share your research!

But avoid

  • Ask for help, clarification or answering other answers.
  • Make statements based on opinions; secure them with references or personal experiences.

For more information, see our tips for writing great answers.

linux – Oh my ZSH, no Unicode characters

I have installed Arch Linux on my work computer and I currently configure it for my liking.
I have installed the needed packages (Xorg, Gnome3, urxvt etc.) and created these point files:

.xinitrc

export GDK_BACKEND = x11
exec gnome session

.zprofile

if [[ ! $DISPLAY && XDG_VTNR -eq 1 ]]; then
exec startx
fi

However, if I install Oh my ZSH and test it with urxvt, the Unicode characters will not be displayed at all.
Screenshot urxvt

Does anyone know how to fix it?