Scyron
October 4th, 2008, 05:35 AM
I'm writing a extremely basic bash script that unmounts any current items in /media/cdrom, mounts an iso there, and then runs a executable on the mounted disk using wine. Here's the gist:
#!/bin/bash
# mount_and_run
sudo umount '/media/cdrom'
sudo mount -o loop -t iso9660 '/iso/location' '/media/cdrom'
wine '/media/cdrom/run.exe'
When I run this script by typing "mount_and_run" in the terminal, it works perfectly.
When I click the script and select "Run", it runs the executable (if the iso is already mounted) but does not unmount or mount.
When I click the script and select "Run in terminal", it unmounts and mounts but does not run the executable.
In practice, I have to open the script twice for it to work in the GUI. I surmise problem (a) is that the script will not run sudo commands from GUI choices, and problem (b) is that the script completes each command and quits, not leaving the program running.
I've tried workarounds involving launchers, but to no avail. Is there anyway I can get the script to run in the GUI like it does in the terminal?
#!/bin/bash
# mount_and_run
sudo umount '/media/cdrom'
sudo mount -o loop -t iso9660 '/iso/location' '/media/cdrom'
wine '/media/cdrom/run.exe'
When I run this script by typing "mount_and_run" in the terminal, it works perfectly.
When I click the script and select "Run", it runs the executable (if the iso is already mounted) but does not unmount or mount.
When I click the script and select "Run in terminal", it unmounts and mounts but does not run the executable.
In practice, I have to open the script twice for it to work in the GUI. I surmise problem (a) is that the script will not run sudo commands from GUI choices, and problem (b) is that the script completes each command and quits, not leaving the program running.
I've tried workarounds involving launchers, but to no avail. Is there anyway I can get the script to run in the GUI like it does in the terminal?