0

I'm trying to make my CV build script run on Ubuntu. I usually use Fedora to build it. Each page is written in SVG, I use Inkscape to generate PDF and then pdfmerge to join those pages into one.

On Ubuntu I can't find pdfmerge so I wanted to change it to pdfunite. But it seems the command doesn't accept the glob patterns. It should be handled by the shell:

pdfunite pl/jakub-jankiewicz-cv-page{1,2,3}.pdf jakub-jankiewicz-cv-pl.pdf
I/O Error: Couldn't open file 'pl/jakub-jankiewicz-cv-page{1,2,3}.pdf': No such file or directory.
Syntax Error: Could not merge damaged documents ('pl/jakub-jankiewicz-cv-page{1,2,3}.pdf')
make: *** [Makefile:22: jakub-jankiewicz-cv-pl.pdf] Błąd 255

This is the code I have in my Makefile:

jakub-jankiewicz-cv-pl.pdf: pl/jakub-jankiewicz-cv-page1.pdf pl/jakub-jankiewicz-cv-page2.pdf pl/jakub-jankiewicz-cv-page3.pdf
    pdfunite pl/jakub-jankiewicz-cv-page{1,2,3}.pdf jakub-jankiewicz-cv-pl.pdf

Why I can't use a glob pattern like {1,2,3} on Ubuntu? I have Xubuntu 22.04 and bash 5.1.16(1)-release the same code works fine on Fedora.

jcubic
  • 914
  • 6
  • 16
  • 31

1 Answers1

6

{1,2,3} isn't a glob pattern - it's a brace expansion. Likely the issue is not that "bash can't read" it - it's that the make command uses the POSIX /bin/sh shell by default, which on Ubuntu is symbolically linked to /bin/dash rather than /bin/bash. Your options are either:

  1. change the brace expansion to an actual (POSIX compliant) glob - for a single digit, that's straightforward i.e. pl/jakub-jankiewicz-cv-page[123].pdf

  2. change the shell in your Makefile to bash, by adding SHELL := /bin/bash

See also Bash is abnormal in Makefile!.

steeldriver
  • 142,475