On Sat, 15 Nov 2014, charlie wrote:
> Hi All, I've tried a couple ways and I can't get it to work, the first way
> is always starting firefox
>
> function select_or_start_ffx
> status = (wmctrl -a "Firefox")
> if status == 0
> firefox
> end
> end
>
> and for this version
>
> function select_or_start_ffx
> wmctrl -a "Firefox"
> if $status == 0
> firefox
> end
> end
>
>
> I get the error
>
> *Standard input: if $status == 0*
> * ^*
> *in function “*select_or_start_ffx*”,*
> * called on standard input,*
>
> *No command '$status' found, did you mean*
>
> whats the proper way to do this ?
The long way is:
function select_or_start_ffx
wmctrl -a "Firefox"
if test $status -eq 0
firefox
end
end
You need to use the `test` builtin so that `if` has something to check
the return value of. Alternatively, you can shorten it to:
function select_or_start_ffx
if wmctrl -a "Firefox"
firefox
end
end
Hope that helps. I think you might be getting mixed up with the return
values from wmctrl - it returns 1 if the window doesn't exist, so try
changing the test to `-ne 0` or `if not wmctrl...` respectively.
David Adam
zanc...@ucc.gu.uwa.edu.au
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users