Simple Bash Script To Set All Launchers (*.desktop) To Executable Doesn't WorkProblem with script...

Why does a 97 / 92 key piano exist by Bösendorfer?

If A is dense in Q, then it must be dense in R.

Personal or impersonal in a technical resume

Do I have to take mana from my deck or hand when tapping a dual land?

What the heck is gets(stdin) on site coderbyte?

Telemetry for feature health

Sound waves in different octaves

Deciphering cause of death?

How to understand "he realized a split second too late was also a mistake"

Given this phrasing in the lease, when should I pay my rent?

Typing CO_2 easily

How to preserve electronics (computers, iPads and phones) for hundreds of years

Check if object is null and return null

Can I run 125khz RF circuit on a breadboard?

Is there anyway, I can have two passwords for my wi-fi

Is there a RAID 0 Equivalent for RAM?

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

Overlapping circles covering polygon

How much do grades matter for a future academia position?

Is there a reason to prefer HFS+ over APFS for disk images in High Sierra and/or Mojave?

Language involving irrational number is not a CFL

Possible Eco thriller, man invents a device to remove rain from glass

Why would five hundred and five be same as one?



Simple Bash Script To Set All Launchers (*.desktop) To Executable Doesn't Work


Problem with script substitution when running scriptBash script to add/remove desktop launchers to Unity launcher?Desktop file for bash scriptSimple bash script not workingDesktop shortcut doesn't work for script but script work fineassociation window <-> .desktop file <-> launcher entrybash script with simple maths involvedHow to display windows of two different firefox profiles under different dash icons?Opening .desktop file outside of desktop immediately logs outcubic: add custom favourites to gnome3 left panel; .desktop launchers untrusted on ~/Desktop













0















Hoping someone smarter than me can help me...



Launchers on my desktop (.desktop) files lose permission to be executable every time I make major changes to my OS, such as my upgrade to 18.04 (Bionic Beaver) or changing windowing manager (Gnome). After these changes,double clicking each icon provided by a launcher file, for example, audacity.desktop results in a message pop up requesting that I "Trust and Launch" the application. Very inconvenient for me because I have loads of launchers well organized in various folders on the desktop based on what I may be developing (Website design versus printed desktop publishing or multimedia editing and DVD creation, etc.) I should not have to open each application from the launchers, click "Trust and Launch", then close it just to make sure it works later when I really need it. Therefore, I have written a simple BASh script to process all the launchers in a given folder, starting with the ~Desktop/ folder itself, but for some weird reason, it just won't work!
Here is my production script which doesn't work:



#!/bin/sh
for myDesktop in $HOME/Desktop/*.desktop
do /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
done


I end up getting these errors instead of the desired result:



gio: Too many arguments
Usage:
gio set [OPTION…] LOCATION ATTRIBUTE VALUE...
Set a file attribute of LOCATION.
Options:
-t, --type=TYPE Type of the attribute
-n, --nofollow-symlinks Don’t follow symbolic links
[2]+ Done for myDesktop in $HOME/Desktop/*.desktop;
do
/usr/bin/gio set "$myDesktop" "metadata::trusted" "yes";
done


Here is my simulation script which produces the desired output with echo, that is, the desired commands per launcher is simply printed, NOT EXECUTED:



#!/bin/sh
for myDesktop in $HOME/Desktop/*.desktop
do echo /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
done


The commands created by my simulation prints all the commands for each launcher as needed correctly, for example:



/usr/bin/gio set "/home/bruce/Desktop/audacity.desktop" "metadata::trusted" yes


Copying the command above and running it by itself has the desired effect, in this case, audacity launches as "Trust and Launch", but having to run each command at at the cli every single launcher is even less convenient than just double clicking on each launcher icon and then clicking "Trust and Launch" ... back to square one!
Note: Filenames must be quoted because some applications, such as gedit have launchers like "Text Editor.desktop" with spaces in them.



I don't understand why I can get the script to print the correct command for "Trust and Launch" on each *.desktop launcher but BASh refuses to actually run them (after removing the echo command). I have never seen anything like that before, simulation works, but the actual script consistently fails.



Help!



Thanks in advance









share



























    0















    Hoping someone smarter than me can help me...



    Launchers on my desktop (.desktop) files lose permission to be executable every time I make major changes to my OS, such as my upgrade to 18.04 (Bionic Beaver) or changing windowing manager (Gnome). After these changes,double clicking each icon provided by a launcher file, for example, audacity.desktop results in a message pop up requesting that I "Trust and Launch" the application. Very inconvenient for me because I have loads of launchers well organized in various folders on the desktop based on what I may be developing (Website design versus printed desktop publishing or multimedia editing and DVD creation, etc.) I should not have to open each application from the launchers, click "Trust and Launch", then close it just to make sure it works later when I really need it. Therefore, I have written a simple BASh script to process all the launchers in a given folder, starting with the ~Desktop/ folder itself, but for some weird reason, it just won't work!
    Here is my production script which doesn't work:



    #!/bin/sh
    for myDesktop in $HOME/Desktop/*.desktop
    do /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
    done


    I end up getting these errors instead of the desired result:



    gio: Too many arguments
    Usage:
    gio set [OPTION…] LOCATION ATTRIBUTE VALUE...
    Set a file attribute of LOCATION.
    Options:
    -t, --type=TYPE Type of the attribute
    -n, --nofollow-symlinks Don’t follow symbolic links
    [2]+ Done for myDesktop in $HOME/Desktop/*.desktop;
    do
    /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes";
    done


    Here is my simulation script which produces the desired output with echo, that is, the desired commands per launcher is simply printed, NOT EXECUTED:



    #!/bin/sh
    for myDesktop in $HOME/Desktop/*.desktop
    do echo /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
    done


    The commands created by my simulation prints all the commands for each launcher as needed correctly, for example:



    /usr/bin/gio set "/home/bruce/Desktop/audacity.desktop" "metadata::trusted" yes


    Copying the command above and running it by itself has the desired effect, in this case, audacity launches as "Trust and Launch", but having to run each command at at the cli every single launcher is even less convenient than just double clicking on each launcher icon and then clicking "Trust and Launch" ... back to square one!
    Note: Filenames must be quoted because some applications, such as gedit have launchers like "Text Editor.desktop" with spaces in them.



    I don't understand why I can get the script to print the correct command for "Trust and Launch" on each *.desktop launcher but BASh refuses to actually run them (after removing the echo command). I have never seen anything like that before, simulation works, but the actual script consistently fails.



    Help!



    Thanks in advance









    share

























      0












      0








      0








      Hoping someone smarter than me can help me...



      Launchers on my desktop (.desktop) files lose permission to be executable every time I make major changes to my OS, such as my upgrade to 18.04 (Bionic Beaver) or changing windowing manager (Gnome). After these changes,double clicking each icon provided by a launcher file, for example, audacity.desktop results in a message pop up requesting that I "Trust and Launch" the application. Very inconvenient for me because I have loads of launchers well organized in various folders on the desktop based on what I may be developing (Website design versus printed desktop publishing or multimedia editing and DVD creation, etc.) I should not have to open each application from the launchers, click "Trust and Launch", then close it just to make sure it works later when I really need it. Therefore, I have written a simple BASh script to process all the launchers in a given folder, starting with the ~Desktop/ folder itself, but for some weird reason, it just won't work!
      Here is my production script which doesn't work:



      #!/bin/sh
      for myDesktop in $HOME/Desktop/*.desktop
      do /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
      done


      I end up getting these errors instead of the desired result:



      gio: Too many arguments
      Usage:
      gio set [OPTION…] LOCATION ATTRIBUTE VALUE...
      Set a file attribute of LOCATION.
      Options:
      -t, --type=TYPE Type of the attribute
      -n, --nofollow-symlinks Don’t follow symbolic links
      [2]+ Done for myDesktop in $HOME/Desktop/*.desktop;
      do
      /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes";
      done


      Here is my simulation script which produces the desired output with echo, that is, the desired commands per launcher is simply printed, NOT EXECUTED:



      #!/bin/sh
      for myDesktop in $HOME/Desktop/*.desktop
      do echo /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
      done


      The commands created by my simulation prints all the commands for each launcher as needed correctly, for example:



      /usr/bin/gio set "/home/bruce/Desktop/audacity.desktop" "metadata::trusted" yes


      Copying the command above and running it by itself has the desired effect, in this case, audacity launches as "Trust and Launch", but having to run each command at at the cli every single launcher is even less convenient than just double clicking on each launcher icon and then clicking "Trust and Launch" ... back to square one!
      Note: Filenames must be quoted because some applications, such as gedit have launchers like "Text Editor.desktop" with spaces in them.



      I don't understand why I can get the script to print the correct command for "Trust and Launch" on each *.desktop launcher but BASh refuses to actually run them (after removing the echo command). I have never seen anything like that before, simulation works, but the actual script consistently fails.



      Help!



      Thanks in advance









      share














      Hoping someone smarter than me can help me...



      Launchers on my desktop (.desktop) files lose permission to be executable every time I make major changes to my OS, such as my upgrade to 18.04 (Bionic Beaver) or changing windowing manager (Gnome). After these changes,double clicking each icon provided by a launcher file, for example, audacity.desktop results in a message pop up requesting that I "Trust and Launch" the application. Very inconvenient for me because I have loads of launchers well organized in various folders on the desktop based on what I may be developing (Website design versus printed desktop publishing or multimedia editing and DVD creation, etc.) I should not have to open each application from the launchers, click "Trust and Launch", then close it just to make sure it works later when I really need it. Therefore, I have written a simple BASh script to process all the launchers in a given folder, starting with the ~Desktop/ folder itself, but for some weird reason, it just won't work!
      Here is my production script which doesn't work:



      #!/bin/sh
      for myDesktop in $HOME/Desktop/*.desktop
      do /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
      done


      I end up getting these errors instead of the desired result:



      gio: Too many arguments
      Usage:
      gio set [OPTION…] LOCATION ATTRIBUTE VALUE...
      Set a file attribute of LOCATION.
      Options:
      -t, --type=TYPE Type of the attribute
      -n, --nofollow-symlinks Don’t follow symbolic links
      [2]+ Done for myDesktop in $HOME/Desktop/*.desktop;
      do
      /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes";
      done


      Here is my simulation script which produces the desired output with echo, that is, the desired commands per launcher is simply printed, NOT EXECUTED:



      #!/bin/sh
      for myDesktop in $HOME/Desktop/*.desktop
      do echo /usr/bin/gio set "$myDesktop" "metadata::trusted" "yes"
      done


      The commands created by my simulation prints all the commands for each launcher as needed correctly, for example:



      /usr/bin/gio set "/home/bruce/Desktop/audacity.desktop" "metadata::trusted" yes


      Copying the command above and running it by itself has the desired effect, in this case, audacity launches as "Trust and Launch", but having to run each command at at the cli every single launcher is even less convenient than just double clicking on each launcher icon and then clicking "Trust and Launch" ... back to square one!
      Note: Filenames must be quoted because some applications, such as gedit have launchers like "Text Editor.desktop" with spaces in them.



      I don't understand why I can get the script to print the correct command for "Trust and Launch" on each *.desktop launcher but BASh refuses to actually run them (after removing the echo command). I have never seen anything like that before, simulation works, but the actual script consistently fails.



      Help!



      Thanks in advance







      bash scripts .desktop





      share












      share










      share



      share










      asked 5 mins ago









      Bruce E. ReedBruce E. Reed

      212




      212






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2faskubuntu.com%2fquestions%2f1127393%2fsimple-bash-script-to-set-all-launchers-desktop-to-executable-doesnt-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1127393%2fsimple-bash-script-to-set-all-launchers-desktop-to-executable-doesnt-work%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

          Is there a lightweight tool to crop images quickly?Cropping Images using Command Line Tools OnlyHow to crop...

          List of shipwrecks in 1808...

          Unit packagekit.service is masked Announcing the arrival of Valued Associate #679: Cesar...