Re: Need help with shell script.
The Natural Philosopher <[email protected]>
| Newsgroups | comp.os.linux.misc |
|---|---|
| Organization | A little, after lunch |
| Message-ID | <[email protected]> |
On 10/08/2026 06:04, pH wrote: > On 2026-08-10, c186282 <[email protected]> wrote: >> On 8/9/26 21:01, Eli the Bearded wrote: >>> In comp.os.linux.misc, pH <[email protected]> wrote: >>>> so I thought I'd make a clickable icon on the Desktop to make it easy for >>>> her. >>>> the file "move_pictures" contains: >>>> !/bin/bash, >>>> mv ~/Desktop/*JPG ~/Desktop/Beckys_stuff/ >>>> mv ~/Desktop/*PDF ~/Desktop/Beckys_stuff/ >>> >>> If that's your script, one issue looks like the first line: >>> >>> #!/bin/bash >>> >>> Start with a # and no comma. >>> >>>> But when I click on it I get an error messaage that pops up in a small >>>> window that says: "There was an error launching the application" >>> >>> There may be more things wrong that are specific to how you created the >>> launcher, but I don't know anything about Mint launchers. >>> >>> Elijah >>> ------ >>> would probably make the script work with lowercase suffixes, too >> >> As "Beckys stuff" may be a TWO-word dir, it's important >> to PUT that all in QUOTES or 'mv' will get confused. >> The example shows an underscore, but is that there in >> the actual script ? > > Beckys_stuff does indeed have an underscore and it is that way in the actual > script. > >> >> Also, has it been marked as 'executable' and WHO >> owns it ??? Finally, command line, the evocation >> usually requires a dot in front of everything. > Well, since I created it I just assumed I owned it. > I have done a "chown MYUSER move_pictures > > and we'll see what happens. > > Can you elaborate on where I need the dot...in the launcher command field? > I'll give it a try... > > >> >> The "#!/bin/bash" is kind of optional these days >> because almost everyone has Bash as their main >> thing anyway. SOME do install and use other shells, >> but only SOME. I think I have c-shell installed >> alongside Bash. >> >> Anyway, try the exact command in terminal and if >> that works then it OUGHT to run as a script. >> > It works fine when I type it manually in a terminal which is why I thought > it'd be a piece of cake as a script. > Does it work when you yourself call it *as a script* ? For some reason none of my desktop icons call scripts.. (Mint MATE) I suspect because it didn't work for me either...or they needed root perms and have C wrappers to do the setuid(0) bit... e,g. #include <stdlib.h> #include <unistd.h> main() { setuid(0); system("/usr/local/scripts/my-script"); } the c program is 666 perms owned and grouped by root sticky bit set -rwsr-xr-x 1 root root 16744 Oct 9 2021 my-script The behaviour you describe is hauntingly familiar, but I cannot recall why... You may care to inspect the desktop file itself... If its on the desktop its in ~/Desktop/myfile etc Or for panel pinned launchers ~/.config/mate/panel2.d/default/launchers.. $ more mater-terminal.desktop #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Icon=/usr/local/share/icons/Desktop/cymbeline.png Icon[en_GB]=/usr/local/share/icons/Desktop/cymbeline.png Name[en_GB]=Cymbeline Exec=mate-terminal --profile=Cymbeline Comment[en_GB]=Local server console Name=Cymbeline Comment=Local server console Note that xdg-open does the opening. Its bot recommended to invoke this via the command line BUT if you do it might give some meaningful errosr message > pH > > -- "And if the blind lead the blind, both shall fall into the ditch". Gospel of St. Mathew 15:14