Does a process that is not a shell process have shell variables?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












A shell (for example: the bash shell) have the concept of shell variables and the concept of environment variables.



But what about other processes that are not shell processes (for example: Firefox, gedit, etc.), do these processes also have shell variables or do they only have environment variables?










share|improve this question

























    up vote
    0
    down vote

    favorite












    A shell (for example: the bash shell) have the concept of shell variables and the concept of environment variables.



    But what about other processes that are not shell processes (for example: Firefox, gedit, etc.), do these processes also have shell variables or do they only have environment variables?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      A shell (for example: the bash shell) have the concept of shell variables and the concept of environment variables.



      But what about other processes that are not shell processes (for example: Firefox, gedit, etc.), do these processes also have shell variables or do they only have environment variables?










      share|improve this question













      A shell (for example: the bash shell) have the concept of shell variables and the concept of environment variables.



      But what about other processes that are not shell processes (for example: Firefox, gedit, etc.), do these processes also have shell variables or do they only have environment variables?







      linux shell environment-variables






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 25 '17 at 8:26









      user7681202

      237414




      237414




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          A non-shell process does not have shell variables. A C program has C variables, an awk program has awk variables, a Perl program has Perl variables, etc., and these are all in their own ways very much different from shell variables.



          The reason another process do not have shell variables (or gets to access shell variables) is that shell variables are not exported (i.e. they are not environment variables), and also because some shells allows for attaching more information to a shell variable than just a string value, such as attributes for read-only variables, integer-only variables, etc. These type attributes (see the typeset built-in command) can't be applied to an environment variable and be used in another process.



          Some shells (like bash) also supports arrays and associative arrays. These structures are too complex for the simple key-value pair format, where both the key (the variable name) and the value are plain text strings, imposed on environment variables, which means that these can't be exported for use in a generic other process.



          All processes have access to the environment variables inherited from their parent processes. Depending on language, there are different ways for a program to access these.



          A C program may use getenv(), an awk program may use its associative array ENVIRON, and a Perl program may use its %ENV hash to access environment variables, for example.



          I don't know gedit, but in vim, you may access environment variables with a shell-like syntax:



          :echo $HOME


          for example. The echo here has nothing to do with echo in the shell, it just happens to work in a similar way. Also, the $HOME string just happens to be the way that vim exposes environment variables to the user.






          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f394273%2fdoes-a-process-that-is-not-a-shell-process-have-shell-variables%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            A non-shell process does not have shell variables. A C program has C variables, an awk program has awk variables, a Perl program has Perl variables, etc., and these are all in their own ways very much different from shell variables.



            The reason another process do not have shell variables (or gets to access shell variables) is that shell variables are not exported (i.e. they are not environment variables), and also because some shells allows for attaching more information to a shell variable than just a string value, such as attributes for read-only variables, integer-only variables, etc. These type attributes (see the typeset built-in command) can't be applied to an environment variable and be used in another process.



            Some shells (like bash) also supports arrays and associative arrays. These structures are too complex for the simple key-value pair format, where both the key (the variable name) and the value are plain text strings, imposed on environment variables, which means that these can't be exported for use in a generic other process.



            All processes have access to the environment variables inherited from their parent processes. Depending on language, there are different ways for a program to access these.



            A C program may use getenv(), an awk program may use its associative array ENVIRON, and a Perl program may use its %ENV hash to access environment variables, for example.



            I don't know gedit, but in vim, you may access environment variables with a shell-like syntax:



            :echo $HOME


            for example. The echo here has nothing to do with echo in the shell, it just happens to work in a similar way. Also, the $HOME string just happens to be the way that vim exposes environment variables to the user.






            share|improve this answer


























              up vote
              2
              down vote



              accepted










              A non-shell process does not have shell variables. A C program has C variables, an awk program has awk variables, a Perl program has Perl variables, etc., and these are all in their own ways very much different from shell variables.



              The reason another process do not have shell variables (or gets to access shell variables) is that shell variables are not exported (i.e. they are not environment variables), and also because some shells allows for attaching more information to a shell variable than just a string value, such as attributes for read-only variables, integer-only variables, etc. These type attributes (see the typeset built-in command) can't be applied to an environment variable and be used in another process.



              Some shells (like bash) also supports arrays and associative arrays. These structures are too complex for the simple key-value pair format, where both the key (the variable name) and the value are plain text strings, imposed on environment variables, which means that these can't be exported for use in a generic other process.



              All processes have access to the environment variables inherited from their parent processes. Depending on language, there are different ways for a program to access these.



              A C program may use getenv(), an awk program may use its associative array ENVIRON, and a Perl program may use its %ENV hash to access environment variables, for example.



              I don't know gedit, but in vim, you may access environment variables with a shell-like syntax:



              :echo $HOME


              for example. The echo here has nothing to do with echo in the shell, it just happens to work in a similar way. Also, the $HOME string just happens to be the way that vim exposes environment variables to the user.






              share|improve this answer
























                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                A non-shell process does not have shell variables. A C program has C variables, an awk program has awk variables, a Perl program has Perl variables, etc., and these are all in their own ways very much different from shell variables.



                The reason another process do not have shell variables (or gets to access shell variables) is that shell variables are not exported (i.e. they are not environment variables), and also because some shells allows for attaching more information to a shell variable than just a string value, such as attributes for read-only variables, integer-only variables, etc. These type attributes (see the typeset built-in command) can't be applied to an environment variable and be used in another process.



                Some shells (like bash) also supports arrays and associative arrays. These structures are too complex for the simple key-value pair format, where both the key (the variable name) and the value are plain text strings, imposed on environment variables, which means that these can't be exported for use in a generic other process.



                All processes have access to the environment variables inherited from their parent processes. Depending on language, there are different ways for a program to access these.



                A C program may use getenv(), an awk program may use its associative array ENVIRON, and a Perl program may use its %ENV hash to access environment variables, for example.



                I don't know gedit, but in vim, you may access environment variables with a shell-like syntax:



                :echo $HOME


                for example. The echo here has nothing to do with echo in the shell, it just happens to work in a similar way. Also, the $HOME string just happens to be the way that vim exposes environment variables to the user.






                share|improve this answer














                A non-shell process does not have shell variables. A C program has C variables, an awk program has awk variables, a Perl program has Perl variables, etc., and these are all in their own ways very much different from shell variables.



                The reason another process do not have shell variables (or gets to access shell variables) is that shell variables are not exported (i.e. they are not environment variables), and also because some shells allows for attaching more information to a shell variable than just a string value, such as attributes for read-only variables, integer-only variables, etc. These type attributes (see the typeset built-in command) can't be applied to an environment variable and be used in another process.



                Some shells (like bash) also supports arrays and associative arrays. These structures are too complex for the simple key-value pair format, where both the key (the variable name) and the value are plain text strings, imposed on environment variables, which means that these can't be exported for use in a generic other process.



                All processes have access to the environment variables inherited from their parent processes. Depending on language, there are different ways for a program to access these.



                A C program may use getenv(), an awk program may use its associative array ENVIRON, and a Perl program may use its %ENV hash to access environment variables, for example.



                I don't know gedit, but in vim, you may access environment variables with a shell-like syntax:



                :echo $HOME


                for example. The echo here has nothing to do with echo in the shell, it just happens to work in a similar way. Also, the $HOME string just happens to be the way that vim exposes environment variables to the user.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Sep 25 '17 at 8:58

























                answered Sep 25 '17 at 8:29









                Kusalananda

                106k14209327




                106k14209327



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f394273%2fdoes-a-process-that-is-not-a-shell-process-have-shell-variables%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?