Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: vv73 on August 24, 2013, 01:45:03 pm

Title: Using System Environment Variables
Post by: vv73 on August 24, 2013, 01:45:03 pm
Can I use System Variable, such as $HOME
in General Settings, f.e.
for Terminal Program to run Console application?

Like this

${HOME}/myConsoleapp

Or not?

Thanks!
Title: Re: Using System Environment Variables
Post by: Jenna on August 24, 2013, 02:41:02 pm
As far as I know, this does not work directly, but you can try to run the command in an own shell.
If yoiu start with /bin/sh -c the system variables get expanded.
Title: Re: Using System Environment Variables
Post by: vv73 on August 24, 2013, 03:37:32 pm
Unfortunatelly even

/bin/sh -c /home/admin/.codeblocks/wincall

there does not work, because CB does not expand expand it as I need

Executing: /bin/sh -c /home/admin/.codeblocks/wincall /usr/bin/cb_console_runner "/home/admin/test" (in /home/admin)

sh needs one string, but CB does not make it.

If to write

/bin/sh -c "/home/admin/.codeblocks/wincall"

we get

Executing: /bin/sh -c "/home/admin/.codeblocks/wincall" /usr/bin/cb_console_runner "/home/admin/test" (in /home/admin)

Three strings anyway...

 
Title: Re: Using System Environment Variables
Post by: vv73 on August 24, 2013, 07:39:00 pm
Without -c and quotes

/bin/sh /home/admin/mycall
works well
but
/bin/sh ${HOME}/mycall
no...
Title: Re: Using System Environment Variables
Post by: Jenna on August 24, 2013, 07:41:52 pm
Without -c and quotes

/bin/sh /home/admin/mycall
works well
but
/bin/sh ${HOME}/mycall
no...

If you use /bin/sh, the variable gets expandend by the shel and not by C::B, so use just $HOME .
Title: Re: Using System Environment Variables
Post by: vv73 on August 24, 2013, 08:08:52 pm
/bin/sh $HOME/mycall
no effect...

in Terminal that works fine
with and without {}
Title: Re: Using System Environment Variables
Post by: Jenna on August 24, 2013, 11:13:08 pm
I need the -c here and expanding the variable works fine on fc19 64bit with bash 4.2.45 .
Title: Re: Using System Environment Variables
Post by: vv73 on August 25, 2013, 03:41:31 am
I need the -c here and expanding the variable works fine on fc19 64bit with bash 4.2.45 .
Ok. How can I get the name of the output exefile from the script?
I mean mycall.
Title: Re: Using System Environment Variables
Post by: vv73 on August 25, 2013, 07:22:13 am
BTW

What is marco $TITLE,
it used by default in lunch term inputbox?

I coud not find that in CB documentation.

What macros I can use there except of $TITLE?
Title: Re: Using System Environment Variables
Post by: vv73 on August 27, 2013, 04:21:21 pm
Nobody knows about macros, about $TITLE,
 really?
Title: Re: Using System Environment Variables
Post by: oBFusCATed on August 27, 2013, 04:38:04 pm
I guess this is the title specified in you project -> properties -> project settings
Title: Re: Using System Environment Variables
Post by: vv73 on August 27, 2013, 06:54:06 pm
I guess this is the title specified in you project -> properties -> project settings

I know that.
But it is important for me to know what marcros I can use there except of that.
I dd not find any $TITLE descprition in CB manual...

The question is still actual.

I want to lanch user own script and get the name of output file there.
And it is good to place that script in user home directory and I want use $HOME or
something like that to make the command universe for all users.