Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to switch to zsh. Something I've missed so far is this:

#!/bin/bash
mv /very/long/path/to/file1.conf{,.old}
#bash expandes that to:
mv /very/long/path/to/file1.conf /very/long/path/to/file1.conf.old

What is that called, and is there a zsh equivalent?

share|improve this question
up vote 6 down vote accepted

It is called Brace Expansion and is present also in zsh.

One important difference between bash and zsh is that in zsh parameter expansion is performed inside braces, but in bash this is not the case.

share|improve this answer
    
Very strange; it's working for me now. I tried it before and it gave me some error, so I've been avoiding it for a month or so. – Shawn J. Goff Jan 28 '12 at 14:30
    
I also got an error and blamed it on zsh. Turned out I was just putting a space after the comma in the braces. – Dean Dec 6 '12 at 1:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.