How to make Piperead read awk output?

I’m trying to make a Pipe menu which I’ve successfully done before, but it’s not working this time.

The script IS being run by the Piperead command as I can put a plain echo “AddToMenu blabla…” into the script and have it show up in the menu. I’ve decided awk must output things differently to an echo and fvwm can’t read them the same way.

I’ve been scratching my head about this for 2 days now.

I have the following:

[code]SetEnv fvwm_script $[FVWM_USERDIR]/scripts

DestroyMenu CSServerMenu
AddToMenu CSServerMenu

  • DynamicPopupAction Function MakeCSServerMenu

DestroyFunc MakeCSServerMenu
AddToFunc MakeCSServerMenu

  • I DestroyMenu recreate CSServerMenu
  • I PipeRead ‘exec $[fvwm_script]/’[/code]

#!/bin/bash qstat -nh -default hla2s -f serverlist | awk '{print "AddToMenu CSServerMenu \""$8" "$3" "$2"\" Nop"}'
serverlist is just:
Running in a terminal outputs:

AddToMenu CSServerMenu " de_inferno 18/22" Nop AddToMenu CSServerMenu "GamersUN cs_assault 17/24" Nop AddToMenu CSServerMenu "GameArena de_dust2 15/32" Nop AddToMenu CSServerMenu " de_dust2 0/24" Nop

Don’t forget that in this case, the output is parsed twice:

  • Once for the echo
  • Once for the PipeRead

You’ll want to protect the interpolation most likely, which means:

awk '{print "$$8", "$$7"}'

Always check STDERR, which implies ~/.xsession-errors if FVWM logs there.

No – don’t exec here. Just call the script.

– Thomas Adam

I don’t have a ~/.xsession-errors, where else would FVWM log its errors?
I realised I could switch to tty1 and see errors there. I got it working.
The problem was the serverlist file not being found. It worked in terminal because I would cd into the directory containing and serverlist to run the script.

The double dollar signs didn’t do any good.

Thanks for your help.

EDIT: I got it working directly in the Piperead too.

+ I PipeRead 'qstat -nh -default hla2s -f $[fvwm_script]/serverlist | awk \'{print \"AddToMenu CSServerMenu \\"\"$$$8\" \"$$$3\" \"$$$2\"\\" Nop\"}\''