Page 1 of 1

How to conveniently specify a long line of command options?

Posted: Mon Dec 17, 2007 4:39 am
by Vonigol
Hello!

I am hooking GRUB bootloader's built-in commands. When I use GRUB's "./configure" to rebuild GRUB, I need to specify a lot of options in the command line. This is very inconvenient. Is there any way to type those options in some text file and then use it together with ./configure?

Some examples.

Lets "options.txt" be the file with the command line options that I need to specify. For example, it will contain the following text:

--enable-protector-mode \
--enable-example-kernel \
--disable-reiserfs \
--disable-iso9660 \
--disable-ffs \
"CFLAGS=-g -fno-stack-protector"

I tried the following variants but without success:

1) $ ./configure 'cat options.txt'
2) $ ./configute $(cat options.txt)
3) cat options.txt | ./configure

configure either doesn't understand the backlash ('\') from 'options.txt' or doesn't like CFLAGS. If I copy the text from "options.txt" and then manually insert it immediately after "$ ./configure ", then everything works fine. For example, why doesn't variant number 3) work?

Can anyone help me?

Thanks.

Best regards,
Xela

Posted: Mon Dec 17, 2007 5:32 am
by AJ
How about using a bash script (.rc)? Clicky

Cheers,
Adam

Posted: Mon Dec 17, 2007 6:46 am
by Solar
"alias" might also help.

Re: How to conveniently specify a long line of command optio

Posted: Mon Dec 17, 2007 6:47 am
by blound
Vonigol wrote: --enable-protector-mode \
--enable-example-kernel \
--disable-reiserfs \
--disable-iso9660 \
--disable-ffs \
"CFLAGS=-g -fno-stack-protector"
you need to space seperate them not newline, 'cat' does not understand \ to mean continue on the line
Vonigol wrote: 3) cat options.txt | ./configure
this puts the options on stdin of configure, not the command line

what you should do is space seperate the options ( put them on the same line ) then do

Code: Select all

./configure `cat options.txt`
notice these are ` not '

Thanks

Posted: Mon Dec 17, 2007 6:58 pm
by Vonigol
Thanks everyone. All the advices turned to be useful and workable.