[GTALUG] Command doesn't work in script but works on command line?

Jim Ruxton jim.ruxton at gmail.com
Sat Nov 6 14:18:22 EDT 2021


Thanks Kevin and John. When I capture the output of the script I get:

Capture open error: Device or resource busy

Again this doesn't happen when I run the command from the command line. 
There I get the expected output of:

selected sample format: 16bit

And the mystery continues. Thanks again for the help everyone.

Jim


On 2021-11-06 1:45 p.m., John Sellens via talk wrote:
> On Sat, 2021/11/06 01:32:13PM -0400, Kevin Cozens via talk <talk at gtalug.org> wrote:
> | Modify the script to capture all output from the command as it may help you
> | determine what may be going wrong when you run the command in a script.
> | (e.g. >& messages.txt)
>
> I'll echo Kevin's suggestion, and mention that potentially the output
> of "printenv" might be informative, and I think you can capture everything
> from a script by using (after the #! line)
>      exec >/tmp/output 2>&1
> which I think sends all output of all following commands to /tmp/output.
>
> I also try to check the result of commands in scripts and complain e.g.
>      alsa_out args ... \
> 	|| echo 1>&2 "oh not alsa_out failed"
> or
>      alsa_out args ...
>      ret=$?
>      if [ $ret -ne 0 ]; then
> 	echo 1>&2 "alsa_out failed with $ret"
>
> Hope that helps
>
> John
> ---
> Post to this mailing list talk at gtalug.org
> Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk


More information about the talk mailing list