WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: exporting from shellscript  (Read 2169 times)

Offline halma

  • Full Member
  • ***
  • Posts: 164
exporting from shellscript
« on: September 13, 2018, 01:29:26 PM »
hi,

i am trying to get ccache extension working under TC9.x/x64
i have an ccache tce.installed script which creates the symlinks for ccache compilers on bootup, but i need to
set an $PATH environment variable too. Usually each shellscript has its own process structure/childs/parent.
Someone has an idea how it is possible to set an $PATH environment variable which is like global avaible ?

what i tried so far:
Code: [Select]
#!/bin/sh

echo "#!/bin/sh" > export-variable-script.sh
echo "" >> export-variable-script.sh
echo "export foo=bar" >> export-variable-script.sh
chmod u+x export-variable-script.sh
source ./export-variable-script.sh
but
Code: [Select]
echo $foo
returns nothing
if possible the code should be undependend, not set export in ~/.bashrc or ~/.profile

Thanks
« Last Edit: September 13, 2018, 01:31:35 PM by halma »
1 + 2 = 6  cause  10 - 6 = 78 ;-) lol

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: exporting from shellscript
« Reply #1 on: September 13, 2018, 01:58:43 PM »
Hi halma
Setting it in  ~/.profile  would probably be the simplest solution. After adding it to  ~/.profile  you'll need to logout/login or
reboot for it to take affect.