Take the 2-minute tour ×
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.

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
add comment

1 Answer

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
add comment

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.