Forum › Forums › General › Tips and Tricks › bash script exec : with sudo ?
- This topic has 4 replies, 3 voices, and was last updated Nov 14-6:50 pm by kouroukinos77.
-
AuthorPosts
-
November 5, 2020 at 11:29 pm #44464Member
kouroukinos77
Hi I try to write an bash executable script for launch two command, but I need sudo to execute :
#!/bin/bash sudo modprobe snd_pcm_oss snd_mixer oss exec zsnesIn command line it work, he said me enter the password for root…
But in thunar or pcmanfm I don’t have the message for enter root password, and the modprobe don’t work, and I don’t have sound in zsnes, I’m try when I click on this script to launche zsnes with that command “modprobe” … but how to do that ? Thank you for the help !$ uname -r
4.9.212-antix.1-amd64-smp
Mon retour de inxi -Fxz : https://pastebin.com/kqRMrRZZ
my xmpp : weerbor@jabber.frNovember 6, 2020 at 8:35 am #44487Member
sybok
::If you want to run it not from terminal, try to open terminal (e.g. roxterm, lxterminal) and execute the command (-e) of your script.
This will always open pop-up window#!/bin/bash roxterm -e "<command from your script> && exit 0"The && exit 0 ensures the pop-up terminal closes if the execution has been successful but it stays open if any problems encountered.
This is useful for debugging.- This reply was modified 2 years, 6 months ago by sybok. Reason: Word selection improved
November 6, 2020 at 10:07 am #44493Member
Xecure
::#!/bin/bash sudo modprobe snd_pcm_oss snd_mixer oss exec zsnesChange this, following sybok’s advice:
#!/bin/bash x-terminal-emulator -e "sudo modprobe snd_pcm_oss snd_mixer oss && exit 0" zsnes &antiX Live system enthusiast.
General Live Boot Parameters for antiX.November 6, 2020 at 10:29 am #44499Member
sybok
::Ah, I forgot to/didn’t put the zsnes after the && exit 0.
Thanks for correcting, Xecure.- This reply was modified 2 years, 6 months ago by sybok.
November 14, 2020 at 6:50 pm #44972Member
kouroukinos77
::Oh ok ! so,
on Icewm, I need to create on my Desktop, a short icon, for launch that… Or in the Icewm menu, but I don’t know how to do that. It’s same for my HMA cli Launcher (VPN), and Icecat. Thank you !
oh sorry, I solved this problem like this :
In my .icewm menu , I add this line :
prog HMA ! bash /home/pikaburk/hma-vpn.sh /home/pikaburk/hma-vpn.sh /home/pikaburk/hma-vpn.sh prog Icecat ! bash /home/pikaburk/icecat.bash /home/pikaburk/icecat.bash /home/pikaburk/icecat.bash(just for add apulse for icecat and the sound, and hma-vpn launch in roxterm), but the command for launch directly hma with london vpn server don’t work (the
sudo hma-linux/hma-openvpn.sh -p udp Londonwith the bash script that I download on the official website); but it’s not a problem and the subject) and I create a ticket for that on hma website. Thank you !and with your bash learning, It work good now. Thank for the studies.
- This reply was modified 2 years, 5 months ago by kouroukinos77.
- This reply was modified 2 years, 5 months ago by kouroukinos77.
- This reply was modified 2 years, 5 months ago by kouroukinos77.
$ uname -r
4.9.212-antix.1-amd64-smp
Mon retour de inxi -Fxz : https://pastebin.com/kqRMrRZZ
my xmpp : weerbor@jabber.fr -
AuthorPosts
- You must be logged in to reply to this topic.