3

Pass '-1' option to ls if piped to grep in zsh

view full story
linux-howto

http://unix.stackexchange.com – I just decided to give zsh a go against Bash and came across some unhandy behaviour about which I couldn't find anything on the net: If you do a ls | grep foo in Bash, the ls only contains one file per line so that grep only outputs the matching files. It seems like somewhere (and since I couldn' find anything in the config I think it must be the Bash code itself), the -1 option is passed to ls. zsh however doesn't do that magic: If you pass ls without further options to grep, it does just that and you also get result's which coincidentally appeared on the same line as a match. My idea to ac (HowTos)