I use 'noglob' in many places, and sometimes they leak into my bash scripts, or are called from bash somehow. As bash doesn't know about noglob, usual result is an error.
But! you can use this
cat <<-EOF >~/bin/noglob
#!/usr/bin/env bash
$*
EOF
So a bypass file is called in case the command 'noglob' is not catched by the shell.
EDIT: Now I remember why the f I created this.
You know I'm a heavy user of zsh's global aliases. my aliases that contain pipes are always UPPERCASE, because it gives a hint that something strange is happening there, and I also see it entering the realm of pipes.
The thing is that when pairing with others, if I write that when they are looking, people have no clue what's happening when I type that, and it's pretty unintuitive. Also, as my zsh and bash share part of the history, if I reach some command that contains one of the magic aliases, I've to manually fix them by expanding by hand.
1st fix: magic expansions
globalias() { if [[ $LBUFFER =~ ' [A-Z0-9]+$' ]]; then zle _expand_alias zle expand-word fi zle self-insert } zle -N globalias bindkey " " globalias
This expands the previous word if it's an alias, but I only want to expand the ones that are ALL CAPSLOCK. Because I have very nasty aliases I don't want to expand as I go. (This has extra an benefit of allowing expansions of "dynamic aliases", which I'll show in some other post)
With this, I end up with noglobs scattered around my history, and if for some reason I execute those in bash, it'll try to run `noglob http ....`. Here is where ~/bin/noglob works fine by just bypassing everything.
No hay comentarios:
Publicar un comentario