InterviewSolution
| 1. |
How Do I Export Or Pass Variables Back Into The Environment? |
|
Answer» SUPPOSE that line #1, word #2 of the file 'terminals' contains a VALUE to be put in your TERM environment variable. Sed cannot export variables directly to the SHELL, but it can pass strings to shell commands. To SET a variable in the Bourne shell:TERM=`sed 's/^[^ ][^ ]* ([^ ][^ ]*).*/1/;q' terminals`; If the second word were "Wyse50", this would send the shell command "TERM=Wyse50". Suppose that line #1, word #2 of the file 'terminals' contains a value to be put in your TERM environment variable. Sed cannot export variables directly to the shell, but it can pass strings to shell commands. To set a variable in the Bourne shell:TERM=`sed 's/^[^ ][^ ]* ([^ ][^ ]*).*/1/;q' terminals`; If the second word were "Wyse50", this would send the shell command "TERM=Wyse50". |
|