in reply to SOLVED Backticks and shell brace expansion

I cannot reproduce the problem:
$ touch perl.err perl.tst $ ls perl.* perl.err perl.tst $ perl -e '`rm {perl.err,perl.tst}`'; $ ls perl.* ls: perl.*: No such file or directory
This is on Linux and GNU bash. I think that a real Bourne shell does not have brace expansion.

What happens if you do rm {perl.err,perl.tst} in an instance of /bin/sh? Or rather, what happens if you do /bin/sh -c "rm {perl.err,perl.tst}"?

Replies are listed 'Best First'.
Re^2: Backticks and shell brace expansion
by differenceengine (Novice) on Aug 01, 2011 at 20:55 UTC

    Thanks for the responses!

    JavaFan, you have it there... on the Linux (Ubuntu) box /bin/sh is a symlink to dash which doesn't have brace expansion. I assumed /bin/sh would be a link to bash but it ain't. On the FreeBSD, I thought I was using /bin/sh but actually my user accounts are set to use tcsh.

    Perl always calls /bin/sh so that's why brace expansion doesn't work. On both systems Perl is not using a shell that supports it (whereas my terminal sessions are).

    Thankyou FunkyMonk for the unlink/glob hint. Looks like a neater, more Perl-ish way of doing what I need so I will look into it.

    Thanks again all.