News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Using System Environment Variables

Started by vv73, August 24, 2013, 01:45:03 PM

Previous topic - Next topic

vv73

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!

Jenna

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.

vv73

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...



vv73

Without -c and quotes

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

Jenna

Quote from: 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...

If you use /bin/sh, the variable gets expandend by the shel and not by C::B, so use just $HOME .

vv73

#5
/bin/sh $HOME/mycall
no effect...

in Terminal that works fine
with and without {}

Jenna

I need the -c here and expanding the variable works fine on fc19 64bit with bash 4.2.45 .

vv73

#7
Quote from: jens 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 .
Ok. How can I get the name of the output exefile from the script?
I mean mycall.

vv73

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?

vv73

Nobody knows about macros, about $TITLE,
really?

oBFusCATed

I guess this is the title specified in you project -> properties -> project settings
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

vv73

Quote from: oBFusCATed on August 27, 2013, 04:38:04 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.