Getting `make install` for bash_completion source

This is part of the installation of my Makefile:

install:
    for e in $(EXEC); do \
        sudo cp --remove-destination ${CURDIR}/$$e /usr/local/bin; done
    sudo cp ${CURDIR}/bin/stage2.d /etc/bash_completion.d/stage2
    . /etc/bash_completion

Where "stage2" is the name of my executable file.

The last line is what gives the problem. After adding the file to the directory bash_completion.dI want source bash_completion. But the call sourceor .gives:

. /etc/bash_completion
/etc/bash_completion: 32: [[: not found
/etc/bash_completion: 38: [[: not found
/etc/bash_completion: 50: Bad substitution
make: *** [install] Error 2
+3
source share
2 answers

Use /bin/shby default. you must force it to use bash as it is [[not supported by normal sh.

gnu make allows you to set a variable SHELL[in the makefile] to force it to use bash. So you will need to add a line

SHELL=/bin/bash

at the top of your makefile

+2
source

:

  • sudo Makefile - . sudo make install.
  • bash_completion , make? .

:

install:
    $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
    $(INSTALL) -m 0755 -p $(EXEC) $(DESTDIR)$(bindir)/
    $(INSTALL) -m 0755 -d $(DESTDIR)$(sysconfdir)/bash_completion.d
    $(INSTALL) -m 0644 -p ${CURDIR}/bin/stage2.d $(DESTDIR)$(sysconfdir)/bash_completion.d/stage2

make

sudo make install && . /etc/bash_completion.d/stage2

. README , install:, .

+3

Source: https://habr.com/ru/post/1790993/


All Articles