0

In my omakefile, I have a variable name 'CHECK' with variable value 'hello'. My question is how can I read/print only 'h'?

Example:

Input:

CHECK = hello

Output:

h

I know how to print entire variable $(CHECK).

What I tried:

Input:

CHECK = hello
FIRST=$(shell echo $(CHECK) | head -c 1)

Output of FIRST VARIABLE:

(Empty)
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
Kamaraj
  • 63
  • 1
  • 8
  • Please, avoid using tags which are unrelated to your problem. If you don't know meaning of a specific tag, then hover a cursor over it and read its description. – Tsyvarev Jul 07 '22 at 09:37
  • @Tsyvarev No , i tried this https://stackoverflow.com/questions/12798666/get-the-first-letter-of-a-make-variable , not working – Kamaraj Jul 07 '22 at 09:57
  • Please, show (add description to the question post) what **exactly** have you **tried** and your **results** of those attempts. – Tsyvarev Jul 07 '22 at 10:00
  • @Tsyvarev Added Description what i tried , thank you – Kamaraj Jul 07 '22 at 10:19
  • BTW, why have you reverted "omake" tag? As you could find in the description of that tag, it denotes build system which is **different** from Make. And another tag of your question, "makefile", refers to the writting files for Make. So, which **language** you are programming for? – Tsyvarev Jul 07 '22 at 11:47
  • @Tsyvarev - omake language – Kamaraj Jul 07 '22 at 11:54
  • According to [omake documentation](http://projects.camlcity.org/projects/dl/omake-0.10.5/doc/html/omake-quickstart.html#sec3), in OMake a script file is referred as "OMakefile". Please, edit your question to use proper terminology ("OMakefile" instead of "makefile") and remove "makefile" tag: this tag has noting common with your question. – Tsyvarev Jul 07 '22 at 12:11
  • If you really are using omake, then that is not the same as GNU make, they are entirely different things. You can't use GNU make syntax (such as `$(shell ...)`) in an omakefile, it won't work. You need to restrict your searches to omake-specific results and read the omake documentation, not the GNU make documentation. – MadScientist Jul 07 '22 at 13:40
  • @MadScientist: The question contains `$(shell ...)` attempt as an evidence why the duplicate, suggested by me, is not suited. Initially the question post was massively mistagged, so I incorrectly interpreted it as being about Make. This is why I suggested a Make duplicate. Only later I found out that the question is actually about omake, not Make. – Tsyvarev Jul 08 '22 at 08:01
  • Agreed. My comment was directed at the OP (Kamaraj). – MadScientist Jul 08 '22 at 12:44

0 Answers0