I’m trying to utilize GRB’s git helpers (https://github.com/garybernhardt/dotfiles/blob/master/.githelpers) for pretty printing my git log. The git log –graph –pretty=”tformat:${LOG_FORMAT}” command from line #62 works just fine; printing with colors in iTerm. But as soon a…
Tag: zsh
Show all sourced files in ZSH
I want to see which files got sourced while starting the Z-shell. Does it even keep track and if yes is there a way to list all the files? Answer You could do a at the beginning of the very first file which gets sourced. See man zshoptions.
Why I have to “source vitrualenvwrapper.sh” every time I open a new Terminal?
I use Zsh as my shell and I want to use vitrualenvwrapper. But when I close a terminal then open a new one, I have to “source virtualenvwrapper.sh” again then I can use virtualenvwrapper. Answer You need to put your script source-ing in some shell session initialization file e.g. /etc/zsh/zshrc (g…
Exclude directory when grepping with zsh globbing
I have some file structure which contains projects with build folders at various depths. I’m trying to use zsh (extended) globbing to exclude files in build folders. I tried using the following command and many other variants: grep “string” (^build/)# I’m reading this as “Any fol…
command not found in zsh when it is there
I just installed the android SDK and was trying to run the emulator when this happened: emulator seems to be in one of the $PATH directories, but zsh still says that it wasn’t found. What could be the cause? Answer Solved it. The problem was that emulator was a 32-bit ELF binary, and I didn’t have…
Are linux shell pipes pipelined?
Given a file input.txt if I do something like is the output from the first command continuously passed (as soon as it is generated) as input to the second command? Or does the pipe wait until the first command finishes to start running the second command? Answer Yes, they’re pipelined — each compo…
zsh option to generate the recomended options
There is a nice option when setting up zsh on Ubuntu However, on a fresh Arch Linux install the option is missing. Is there a way to have it (or maybe, I am being picky here) ? Answer This happens when you haven’t got a .zshrc and there’s a /etc/zsh/recommended.zshrc. If you say yes, it’ll j…
deactivate:unset:1: no such hash table element: pydoc
I am trying to setup my new laptop’s development environment. After install zsh I am constantly getting error deactivate:unset:1: no such hash table element: pydoc Please help. I have following simple aliases in my zshrc: Answer You can see virtualenv pr on github. or you can change deactivate () functi…
Parsing parameters with zparseopts, but from within a sourced script
I have a zsh script myscr.zsh, which sources another script zparse.zsh, like this: zparse.zsh expects a variable number of parameters, which do NOT need to be parsed using zparseopt, but zparse.zsh should – among other things – parse the positional parameters passed to mysrc.zsh. This is tricky, s…
zsh parameter expansion syntax: combining default value and conversion to upper case
In a zsh script, outputs the value of the variable X, or 4711 if there is none. outputs the value of the variable X, converted to upper case. I wonder, whether there is a way to combine the two, i.e. to have the effect of without introducing an auxiliary variable. Answer From man zshexpn: If a `${…}` ty…