使无法读取自己编写的文件

时间:2019-05-26 04:43:57

标签: makefile

Makefile:

SHELL=/bin/bash
.PONY: stamp diff
.DEFAULT_GOAL := all

diff:
    diff <(./stamp.txt) <(docker-compose -f docker-compose.test.yml up)

stamp:
    docker-compose -f docker-compose.test.yml up > stamp.txt

all: stamp diff

输出:

$ make
docker-compose -f docker-compose.test.yml up > stamp.txt
Starting ci-test ... done
diff <(./stamp.txt) <(docker-compose -f docker-compose.test.yml up)
/bin/bash: ./stamp.txt: Permission denied
Starting ci-test ... done
0a1,4
> Attaching to ci-test
> ci-test    | Python 3.7.3
> ci-test exited with code 0
> 
\ No newline at end of file
Makefile:26: recipe for target 'diff' failed
make: *** [diff] Error 1

$ ll
total 32
drwxrwxr-x  4 mirror mirror 4096 May 26 07:38 ./
drwxrwxr-x 47 mirror mirror 4096 May 24 15:58 ../
-rw-rw-r--  1 mirror mirror  210 May 26 07:34 docker-compose.test.yml
-rw-rw-r--  1 mirror mirror  103 May 26 07:33 .env
drwxrwxr-x  9 mirror mirror 4096 May 26 07:36 .git/
drwxrwxr-x  3 mirror mirror 4096 May 24 03:29 .idea/
-rw-rw-r--  1 mirror mirror  664 May 26 07:38 Makefile
-rw-rw-r--  1 mirror mirror   92 May 26 07:36 stamp.txt

问题。为什么我得到/bin/bash: ./stamp.txt: Permission denied以及如何解决?

1 个答案:

答案 0 :(得分:1)

您的makefile中有一个错误。这是简化版

 KeyValuePair<string, string> selectedEntry= (KeyValuePair<string, string>)pickWarehouse.SelectedItem;

此行:SHELL=/bin/bash .PHONY: stamp diff .DEFAULT_GOAL := all diff: @diff <(./stamp.txt) <(echo "aaa") stamp: @echo > stamp.txt all: stamp diff 将传递@diff <(./stamp.txt) <(echo "aaa")的执行结果。我想,您正在寻找的是

./stamp.txt