Author Topic: [RESOLVED] [Pre-/Post-build steps] Pipe redirection  (Read 520 times)

Offline smalcom

  • Single posting newcomer
  • *
  • Posts: 2
[RESOLVED] [Pre-/Post-build steps] Pipe redirection
« on: August 18, 2020, 04:23:25 pm »
I'm trying to use pipe redirection in pre-build script

Code: [Select]
grep -r avr_kind_t $(PROJECT_DIR)simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'and got error:
Quote
-------------- Build: Config in simavr (compiler: GNU GCC Compiler)---------------

Running target pre-build steps
grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print  "=" ;}'
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
....

Good, i added '$':
Code: [Select]
grep -r avr_kind_t $(PROJECT_DIR)simavr/cores/ | awk -F '[ :]' '{print $$1 "=" $$3;}'
And got:
Quote
-------------- Build: Config in simavr (compiler: GNU GCC Compiler)---------------

Running target pre-build steps
grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
...

I selecting last command from output:
Code: [Select]
grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'paste it to console and got result without error:
Quote
[email protected] ...path.../simavr/simavr $ grep -r avr_kind_t ...path.../simavr/cores/ | awk -F '[ :]' '{print $1 "=" $3;}'
...path.../simavr/cores/sim_mega48.c=mega48
....
What i'm doing wrong?
Thanks.
« Last Edit: August 19, 2020, 10:47:15 am by smalcom »

Offline smalcom

  • Single posting newcomer
  • *
  • Posts: 2
Re: [Pre-/Post-build steps] Pipe redirection
« Reply #1 on: August 19, 2020, 10:46:43 am »
Problem resolved: internal single quotes
Code: [Select]
' must be changed with
Code: [Select]
'\''Result:
Code: [Select]
bash -c 'grep -r avr_kind_t cores/ | awk -F '\''[ :]'\'' '\''{print $1 "=" $3;}'\'''