1

I am reading this file, a manifest for a flatpak application.

There is the following command:

ln -s /app/{extra,bin}/masterpdfeditor5

What {extra,bin} mean?

1 Answer 1

10

Brace Expansion: https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html

In your particular example, the shell will expand the brace expansion /app/{extra,bin}/masterpdfeditor5 to the two strings /app/extra/masterpdfeditor5 and /app/bin/masterpdfeditor5 (in this order). The ln -s command will receive these two strings as arguments, and as a result it will create a soft link called /app/bin/masterpdfeditor5 pointing to /app/extra/masterpdfeditor5

4
  • 3
    Allow me to add that often, people think that wildcards and other expansion syntax is processed by the commands, e.g. by ln. It's very important to be aware that it is the shell that processes these characters, not the command. The command gets the result of the shell's processing. There are exceptions; for example, find does process wildcards in certain contexts. Commented Mar 31, 2021 at 5:58
  • @berndbausch True. In some cases this may stem from experiences with cmd.exe in Windows. There the command handles wildcards, quotes and even word splitting. Commented Mar 31, 2021 at 9:41
  • It's also worth noting that brace expansion is not glob expansion. Brace expansion is the first to be performed by the shell, before even variable expansion (which is why you can't put variables in a brace expansion without using eval). Commented Mar 31, 2021 at 16:24
  • Please note that this kind of brace processing is specific to ksh93 and bash. It is not a shell feature since it is not part of the POSIX standard.
    – schily
    Commented Apr 1, 2021 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .