Timeline for Is there a limit to the number of scripts that can access a common sub-script with the same variables at the same time?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 17, 2020 at 11:57 | comment | added | Dewey |
I see your point... I forgot that I had left echo $MailFile in the main script when I posted the question. It was only there temporarily to show what the value was when the sub-script finished processing (it was set when I was testing the script) .
|
|
| Apr 17, 2020 at 9:06 | comment | added | fra-san |
I'm saying that, as stated in the answer you have, a value assigned in a subscript (SendLog) never becomes visible to the main (or caller) script. I.e. echo "MailFile: "$MailFile won't print the value given to the variable in SendLog.
|
|
| Apr 17, 2020 at 0:34 | comment | added | Dewey | Thank you fra-san. '$MailFile' is not set at the top level main script, because it's limited to the few lines of code in 'SendLog.sh'. It's only purpose is to create a '.txt' file for 'ssmtp'ing after 'cat'ing the mail header file to the '.log' file. As soon as the '.txt' file is emailed, it is erased and '$MailFile' not called again. Are you saying that it should still be "set" at the top level? | |
| Apr 16, 2020 at 21:51 | comment | added | fra-san |
Apart from the general advice of quoting your variables ("$MailFile", "$TLOG", "MailFile: $MailFile"...)—which is not an issue here, but may cause you headaches should you choose, or maybe automatically generate, file names with blank characters or newlines—you may want to log errors from your scripts (invoking them as script 2>/path/to/err.log). Also, note that MailFile is never set in your main script; not even after SendLog.sh returned.
|
|
| Apr 16, 2020 at 21:02 | answer | added | ctrl-alt-delor | timeline score: 1 | |
| Apr 16, 2020 at 20:55 | history | edited | ctrl-alt-delor | CC BY-SA 4.0 |
formating remove repatition
|
| Apr 16, 2020 at 20:16 | review | First posts | |||
| Apr 16, 2020 at 21:15 | |||||
| Apr 16, 2020 at 20:16 | history | asked | Dewey | CC BY-SA 4.0 |