Weet iemand wat dit juist doet?Use export to export variables from parent shell to shell executing the script
Use ‘. ./myScript.sh’ to ‘source’ the script.
Moderator: Praesidium
Weet iemand wat dit juist doet?Use export to export variables from parent shell to shell executing the script
Use ‘. ./myScript.sh’ to ‘source’ the script.
Code: Select all
When you run a script it is normally invoked in a subshell, meaning
the variables, functions, shell options, and ALIASES you define in the
script are not seen by the parent shell ( the shell from which you
executed the script ). You can execute your script as a "dot" script
to cause it to be executed in the current shell as follows:
. ./MyScript.sh
subshell is da vensterke waar ge in typt en parent shell heel uw systeem ofwa?XenoPhobian wrote:u script sourcen is ook zoiets.. ma das moeilijk om uit te leggen..
ge runt u script meestal IN ne 'subshell', en uwe parent shell (waar gij in werkt) leest standaard niks uit u programma zoals procedures en variabelen. maar door u script te sourcen maakt ge da wel beschikbaar. khoop da't wa duidelijk is :p
Code: Select all
#!/usr/bin/bash
test="Hello Olivier"
Code: Select all
#!/usr/bin/bash
test="testje"
./hello.ksh
echo $test
ksh: kweni, da staat in slides. Normaal deed ik da ook ni maar bij aanmaken van deze is gedaan.XenoPhobian wrote:idd
en nu bijkomende vraag van mij: is die variabele "test" nu overscreven als ge 'gesourced' hebt?
en waarom extension van kshell gebruiken?
Users browsing this forum: No registered users and 1 guest