Help on executing a bash script via shell()

I wish to run this script as sudo from BASIC

cat /home/neill/Documents/get_package_list_in_file.sh
#!/bin/bash
## dpkg -l > /home/neill/Documents/pkg.txt
dpkg -l > $1


neill@HDD-Mint-64:~$ echo "mypassword " | sudo -S /home/neill/Documents/get_package_list_in_file.sh /home/neill/Documents/pkg.txt
[sudo] password for neill: neill@HDD-Mint-64:~$ 

Edit (Opaque): Put script text into preformatted text attribute for readability reasona. No changes to content.

The problem you have is not to run a shell script from a macro since this is easy having a running non-interactive shell script through Shell(<full_path_to_script> <args>). Your problem is that your script looks like to be interactive (and that cannot be handled - afaik - by shell()).

Thus consider to modify your sudo configuration to call the script with NOPASSWD.

My problem also included the inability to shel()l out to an external process such as Firefox. An system update then caused problems with cinnamon crashing (this was caused by me wrongly allow mesa package to be installed (Linux Mint 19). I have done a reinstall of the OS and now find that the problem with shell() out to Firefox no longer exists. I think i have discovered a better way to enter the password and will get back to report on how this works or doesn’t.