Results 1 to 3 of 3
Hi all,
I wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:
./mybin arg1 arg2 ...
then during program execution ...
- 01-14-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 2
Bash script : pass arguments to second level parser
Hi all,
I wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:
./mybin arg1 arg2 ...
then during program execution there's an interactive prompt asking for more parameters:
...
>> (second bunch of arguments here)
...
I'd like to run my program inside a bash script, but I don't know how to give the second level arguments. Any help on how to do that?
thanks in advance.
drugo
- 01-15-2011 #2Just Joined!
- Join Date
- Jan 2010
- Posts
- 27
I would go following way:
Would you need an argument containing spaces, it should be enhanced a bit.Code:#!/bin/bash MYARGS_1="vienas du trys" MYARGS_2="uno dos tres" echo $MYARGS_2 | ./main.exe $MYARGS_1
- 01-15-2011 #3Just Joined!
- Join Date
- Jan 2011
- Posts
- 2
thanks saulius2, I managed to pass the args using bash "here documents". something like
both solutions work.Code:#!/bin/bash ARGS_L1="par1 par2" ARGS_L2="par3" ./mybin $ARGS_L1 << EOF $ARGS_L2 EOF exit 0


Reply With Quote