Conky variable concatenation












0















My problems is to merge these two functions into one:




  1. ${fs_bar 6 dev/sr0} or ${fs_bar 6 /run/media/'home folder name'/'dvd label'}


  2. blkid -s LABEL -o value /dev/sr0



I want to obtain a sort of this:



${fs_bar 6 blkid -s LABEL -o value /dev/sr0}


sr0 is the DVD device.



Basically I want to get the DVD label automatically and pass it to the fs_bar variable. I don't want to type the mount point in the ${fs_bar...} cause it changes based on the DVD.










share|improve this question

























  • So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command?

    – Haxiel
    Feb 14 at 10:19











  • blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2).

    – Ignorant
    Feb 14 at 10:40











  • if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways.

    – Ignorant
    Feb 14 at 10:40
















0















My problems is to merge these two functions into one:




  1. ${fs_bar 6 dev/sr0} or ${fs_bar 6 /run/media/'home folder name'/'dvd label'}


  2. blkid -s LABEL -o value /dev/sr0



I want to obtain a sort of this:



${fs_bar 6 blkid -s LABEL -o value /dev/sr0}


sr0 is the DVD device.



Basically I want to get the DVD label automatically and pass it to the fs_bar variable. I don't want to type the mount point in the ${fs_bar...} cause it changes based on the DVD.










share|improve this question

























  • So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command?

    – Haxiel
    Feb 14 at 10:19











  • blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2).

    – Ignorant
    Feb 14 at 10:40











  • if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways.

    – Ignorant
    Feb 14 at 10:40














0












0








0








My problems is to merge these two functions into one:




  1. ${fs_bar 6 dev/sr0} or ${fs_bar 6 /run/media/'home folder name'/'dvd label'}


  2. blkid -s LABEL -o value /dev/sr0



I want to obtain a sort of this:



${fs_bar 6 blkid -s LABEL -o value /dev/sr0}


sr0 is the DVD device.



Basically I want to get the DVD label automatically and pass it to the fs_bar variable. I don't want to type the mount point in the ${fs_bar...} cause it changes based on the DVD.










share|improve this question
















My problems is to merge these two functions into one:




  1. ${fs_bar 6 dev/sr0} or ${fs_bar 6 /run/media/'home folder name'/'dvd label'}


  2. blkid -s LABEL -o value /dev/sr0



I want to obtain a sort of this:



${fs_bar 6 blkid -s LABEL -o value /dev/sr0}


sr0 is the DVD device.



Basically I want to get the DVD label automatically and pass it to the fs_bar variable. I don't want to type the mount point in the ${fs_bar...} cause it changes based on the DVD.







linux bash shell manjaro conky






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 14 at 14:10









Kusalananda

133k17254417




133k17254417










asked Feb 14 at 9:44









IgnorantIgnorant

62




62













  • So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command?

    – Haxiel
    Feb 14 at 10:19











  • blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2).

    – Ignorant
    Feb 14 at 10:40











  • if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways.

    – Ignorant
    Feb 14 at 10:40



















  • So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command?

    – Haxiel
    Feb 14 at 10:19











  • blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2).

    – Ignorant
    Feb 14 at 10:40











  • if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways.

    – Ignorant
    Feb 14 at 10:40

















So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command?

– Haxiel
Feb 14 at 10:19





So the blkid -s LABEL -o value /dev/sr0 command returns the value of the LABEL tag. That value doesn't seem to be a valid input for the fs_bar command. Can you provide a example of doing this manually, hopefully with some sample output for each command?

– Haxiel
Feb 14 at 10:19













blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2).

– Ignorant
Feb 14 at 10:40





blkid -s LABEL -o value /dev/sr0 gives you the name of the dvd label: for example if you burn a dvd and you call it "Cars of the world", when you type that command in the terminal you get the label "Cars of the world" (you can try it for yourself, put a dvd into the device and type the command in the terminal, you'll get the name of the dvd). I know it is not a standard input for ${fs_bar...} conky variable, that's why i'm here to ask for help. ${fs_bar 6 /} gives the used/free space for the sda disk as a bar (see pic1 ibb.co/KWzjxq2).

– Ignorant
Feb 14 at 10:40













if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways.

– Ignorant
Feb 14 at 10:40





if i type ${fs_bar 6 dev/sr0} in conky, the bar doesn't work but if i type this ${fs_bar 6 /run/media/'home folder name'/'dvd label'} it works; the point is that every dvd has a different label so i have to get it automatically and to do that i need to pass that to the fs_bar variable in some ways.

– Ignorant
Feb 14 at 10:40










1 Answer
1






active

oldest

votes


















0














You can do this using ${eval} to reparse the output of the command ${execi}:



${eval $${fs_bar 6 /run/media/${execi 9999 id -nu}/${execi 5 blkid -s LABEL -o value /dev/sr0}}


Note the double $$ to stop fs_bar from being parsed. The first execi runs only once every 9999 seconds. It gets your user name from the usual id command.



The second execi runs (for example) every 5 seconds to find the label of the dvd. Choose an appropriate polling interval.



The resulting final string is then given to fs_bar by eval.






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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    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%2f500575%2fconky-variable-concatenation%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You can do this using ${eval} to reparse the output of the command ${execi}:



    ${eval $${fs_bar 6 /run/media/${execi 9999 id -nu}/${execi 5 blkid -s LABEL -o value /dev/sr0}}


    Note the double $$ to stop fs_bar from being parsed. The first execi runs only once every 9999 seconds. It gets your user name from the usual id command.



    The second execi runs (for example) every 5 seconds to find the label of the dvd. Choose an appropriate polling interval.



    The resulting final string is then given to fs_bar by eval.






    share|improve this answer




























      0














      You can do this using ${eval} to reparse the output of the command ${execi}:



      ${eval $${fs_bar 6 /run/media/${execi 9999 id -nu}/${execi 5 blkid -s LABEL -o value /dev/sr0}}


      Note the double $$ to stop fs_bar from being parsed. The first execi runs only once every 9999 seconds. It gets your user name from the usual id command.



      The second execi runs (for example) every 5 seconds to find the label of the dvd. Choose an appropriate polling interval.



      The resulting final string is then given to fs_bar by eval.






      share|improve this answer


























        0












        0








        0







        You can do this using ${eval} to reparse the output of the command ${execi}:



        ${eval $${fs_bar 6 /run/media/${execi 9999 id -nu}/${execi 5 blkid -s LABEL -o value /dev/sr0}}


        Note the double $$ to stop fs_bar from being parsed. The first execi runs only once every 9999 seconds. It gets your user name from the usual id command.



        The second execi runs (for example) every 5 seconds to find the label of the dvd. Choose an appropriate polling interval.



        The resulting final string is then given to fs_bar by eval.






        share|improve this answer













        You can do this using ${eval} to reparse the output of the command ${execi}:



        ${eval $${fs_bar 6 /run/media/${execi 9999 id -nu}/${execi 5 blkid -s LABEL -o value /dev/sr0}}


        Note the double $$ to stop fs_bar from being parsed. The first execi runs only once every 9999 seconds. It gets your user name from the usual id command.



        The second execi runs (for example) every 5 seconds to find the label of the dvd. Choose an appropriate polling interval.



        The resulting final string is then given to fs_bar by eval.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 24 at 10:54









        meuhmeuh

        32.3k12054




        32.3k12054






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500575%2fconky-variable-concatenation%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀