On Tue, 10 Dec 2013, John Rose wrote: > I'm trying to obtain the sound output monitor's name (as a string using > the Shell command) for later use in an Exec command (calling ffmpeg). > > Running the appropriate command in a Terminal gives: > john@JohnDesktop:~$ pactl list | grep -A2 '^Source #' | grep 'Name: > .*\.monitor$' | awk '{print $NF}' | tail -n1 > alsa_output.pci-0000_00_1b.0.analog-stereo.monitor > > I have Gambas code for opening FMain form as: > Dim sSoundMonitorExtractor As String > Me.Center() > sSoundMonitorExtractor = Shell$("pactl list | grep -A2 '^Source #' | > grep 'Name: .*\\.monitor$' | awk '{print $NF}' | tail -n1") > Shell sSoundMonitorExtractor To sSoundMonitor > Print "Sound Monitor = " & sSoundMonitor > > I have 2 backslashes in the Shell$'s string as otherwise the compiler > objects. When I run the Gambas executable, the Console displays: > Sound Monitor = > I.e. sSoundMonitor is not set. What am I doing wrong? >
Shell$() is there to quote arguments, not entire commands. Just look at $ gbx3 -e 'Shell$("pactl list")' pactl\ list so you will execute "pactl\ list" which will be interpreted by the shell as a program named "pactl list" which is *not* the program "pactl", called with argument "list". Shell$() is there to sanitise user input. Leave it away and it should work (so far). Regards, Tobi ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user