Live data from Hacker News

Use Zsh

fendrich.se

91–100 of 117 posts

Re: Use Zsh

#91

There's one of these "why you should convert from X to Y" posts every week or so. I understand that a person can be somewhat excited about finding a better application to replace their old stand-by and might feel the need to evangelize. I don't see anything wrong with wanting to introduce others to new software with a helpful attitude. However, it seems like all of the bash-to-zsh posts boil down to better autocomple…

> better autocompletion

Bash has context dependent auto completion as well. So what's the advantage of zsh here?

Re: Use Zsh

#92
post #89
post #87

Earlier quoted context omitted.

> Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say DSC .jpg. No need to cry -- Bash does it this way: DSC{95..107}.jpg.

Ugh... Did you actually try this? dima@fatty:/media/usb/DCIM/100RICOH$ ls R * R0022399.JPG R0022400.JPG R0022401.JPG R0022402.JPG dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*' ls: cannot access R22399*: No such file or directory ls: cannot access R22400*: No such file or directory ls: cannot access R22401*: No such file or directory ls: cannot access R22402*: No such file or directory Bash seems…

How old is your Bash? GNU bash, version 4.2.37(2)-release produces

  $ ls 
  R1004.jpg  R1006.jpg  R1008.jpg  R1010.jpg  R1012.jpg
  R1005.jpg  R1007.jpg  R1009.jpg  R1011.jpg  R1013.jpg
  $ ls R{1005..1009}*
  R1005.jpg  R1006.jpg  R1007.jpg  R1008.jpg  R1009.jpg

Re: Use Zsh

#93
post #92
post #89

Earlier quoted context omitted.

Ugh... Did you actually try this? dima@fatty:/media/usb/DCIM/100RICOH$ ls R * R0022399.JPG R0022400.JPG R0022401.JPG R0022402.JPG dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*' ls: cannot access R22399*: No such file or directory ls: cannot access R22400*: No such file or directory ls: cannot access R22401*: No such file or directory ls: cannot access R22402*: No such file or directory Bash seems…

How old is your Bash? GNU bash, version 4.2.37(2)-release produces $ ls R1004.jpg R1006.jpg R1008.jpg R1010.jpg R1012.jpg R1005.jpg R1007.jpg R1009.jpg R1011.jpg R1013.jpg $ ls R{1005..1009}* R1005.jpg R1006.jpg R1007.jpg R1008.jpg R1009.jpg

Read the post again. Your case works because you have exactly the right number of digits.

Re: Use Zsh

#94
post #89
post #87

Earlier quoted context omitted.

> Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say DSC .jpg. No need to cry -- Bash does it this way: DSC{95..107}.jpg.

Ugh... Did you actually try this? dima@fatty:/media/usb/DCIM/100RICOH$ ls R * R0022399.JPG R0022400.JPG R0022401.JPG R0022402.JPG dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*' ls: cannot access R22399*: No such file or directory ls: cannot access R22400*: No such file or directory ls: cannot access R22401*: No such file or directory ls: cannot access R22402*: No such file or directory Bash seems…

  > How do I pick 9-11 in bash?
Like so:

  file.{9..11}
I think that you mean for the files to be numbered like:

  file.009
  file.010
  file.011
Bash would try to expand:

  file.{9..11}   => file.9   file.10.  file.11
  file.0{9..11}  => file.09  file.010  file.011
  file.00{9..11} => file.009 file.0010 file.0011
Neither would match all files.

Re: Use Zsh

#95
post #89
post #87

Earlier quoted context omitted.

> Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say DSC .jpg. No need to cry -- Bash does it this way: DSC{95..107}.jpg.

Ugh... Did you actually try this? dima@fatty:/media/usb/DCIM/100RICOH$ ls R * R0022399.JPG R0022400.JPG R0022401.JPG R0022402.JPG dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*' ls: cannot access R22399*: No such file or directory ls: cannot access R22400*: No such file or directory ls: cannot access R22401*: No such file or directory ls: cannot access R22402*: No such file or directory Bash seems…

> Ugh... Did you actually try this?

Your point is correct -- Bash is treating these as strings. I didn't have your file names so I tried a similar example, and I just realized I have to correct my example. I have a directory of graphic files with embedded numbers with leading zeros, for example 001 to 031. I was able to say:

$ ls geographic_harbor_2012_06_02_*{1..31}.JPG

And get all the members. But it's not the same as your example.

Re: Use Zsh

#96
post #94
post #89

Earlier quoted context omitted.

Ugh... Did you actually try this? dima@fatty:/media/usb/DCIM/100RICOH$ ls R * R0022399.JPG R0022400.JPG R0022401.JPG R0022402.JPG dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*' ls: cannot access R22399*: No such file or directory ls: cannot access R22400*: No such file or directory ls: cannot access R22401*: No such file or directory ls: cannot access R22402*: No such file or directory Bash seems…

> How do I pick 9-11 in bash? Like so: file.{9..11} I think that you mean for the files to be numbered like: file.009 file.010 file.011 Bash would try to expand: file.{9..11} => file.9 file.10. file.11 file.0{9..11} => file.09 file.010 file.011 file.00{9..11} => file.009 file.0010 file.0011 Neither would match all files.

> Neither would match all files.

True, but this works: file.*{9..11}

It globs on the LHS, and requires the RHS to be literally consistent with the generated index.

I had the same problem with my earlier example, and the above is how I worked it out.

Re: Use Zsh

#97
post #31

I tried using oh-my-zsh, but all of a sudden bringing up a new terminal (on OS X) went from taking ~1 second to ~5 seconds. Totally killed my interest in zsh. I'm sure there's a way to make it all work nicely, but bash has been doing just fine for me, I don't feel the need to figure out an entirely new configuration system for a tool that ultimately has little new utility in my workflow.

Could it be git?

Re: Use Zsh

#98
post #34

Earlier quoted context omitted.

I independently wrote pretty much the same post. http://www.apreche.net/dont-change-the-computer-change-yours...

I'm curious why you choose Windows over OS X. I went from Windows, to Linux, to OS X. To me OS X is an alternative to Linux that just works. I still have a proper shell without resorting to virtualization and splitting systems.

The servers run Linux, so I develop on Linux. I also hate the OSX UI and its restrictive nature. I also play video games. I also do not want to pay out the nose for a Mac. There are tons of reasons.

Re: Use Zsh

#99
post #94
post #89

Earlier quoted context omitted.

Ugh... Did you actually try this? dima@fatty:/media/usb/DCIM/100RICOH$ ls R * R0022399.JPG R0022400.JPG R0022401.JPG R0022402.JPG dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*' ls: cannot access R22399*: No such file or directory ls: cannot access R22400*: No such file or directory ls: cannot access R22401*: No such file or directory ls: cannot access R22402*: No such file or directory Bash seems…

> How do I pick 9-11 in bash? Like so: file.{9..11} I think that you mean for the files to be numbered like: file.009 file.010 file.011 Bash would try to expand: file.{9..11} => file.9 file.10. file.11 file.0{9..11} => file.09 file.010 file.011 file.00{9..11} => file.009 file.0010 file.0011 Neither would match all files.

    echo file.0{09..11}
    file.009 file.010 file.011

Re: Use Zsh

#100

> In Bash, we often use PgUp to search through the command history. In Zsh you just write part of the command and press Up. This will let you cycle through all command lines that contain what you have written, not just those that begins with it. If you don’t write anything Up works as usual, by cycling through all commands. This is not true, you can do that in Bash too (via .inputrc) http://blog.theliuy.com/2011/inpu…

In bash, I press ctrl-r and then enter part of the command. additional ctrl-r's cycle.

Zsh does that as well with the same exact shortcut
Post reply on HN