Use the result of a shell command in a conditional in a makefile -
I am trying to execute a conditional command in a makefile.
I open this work:
if [-z "$ (ls-a mydir)"]; Then \ echo "empty dir"; \ Else \ echo "Non empty Dear"; \ Fi But if I try it in MessFile, "$ (ls-a mydir)" nothing spreads, if asdf is empty:
all: if [-z "$ (ls-A mydir)"]; Then \ echo "empty dir"; \ Else \ echo "Non empty Dear"; ls does not expect the command extension:
$ mkdir mydir $ make if [-z ""]; Then \ echo "empty dir"; \ Else \ echo "Non empty Dear"; \ Fi Lower $ Touch mydir / myfile $ make if [-z ""]; Then \ echo "empty dir"; \ Else \ echo "Non empty Dear"; \ Fi $ decrease $ ls-a mydir myfile
How do I work within the conditional command?
I have little experience in writing the makefile though I think you can add two dollar sign Should use:
all: if [-z "$$ (ls-A mydir)"]; So if you want to show a dollar sign in your recipe, you have to double it ('$$'). This will change your makeup file and $$ (ls-A mydir) :
$ ls mydir / 1 $ Make [["$ (LS-A MDIIR)"]; Then \ echo "empty dir"; \ Else \ echo "Non empty Dear"; \ Fi non-empty Dear $ rm mydir / 1 $ if [-z "$ (ls-A mydir)"]; Then \ echo "empty dir"; \ Else \ echo "Non empty Dear"; \ Fi blank Dior
Comments
Post a Comment