[comp.mail.mush] mush 'cmd' use

kanakis@hsi.UUCP (Tony Kanakis) (07/31/90)

	I am using the following line in my .mushrc file:

________________________________________________________________________________
set print_cmd="enscript -b'TO:  CUST. SUP.' -fCourier10 -Plaser1; lpq -Plaser1"
________________________________________________________________________________

	This works fine but if I try to use a similar command it will not
print at the chosen printer.

________________________________________________________________________________
cmd two 'set print_cmd="enscript -b'TO:  CUST. SUP.'-fCourier10 -Plaser2; lpq -Plaser2"'
________________________________________________________________________________

	I would type in 'two' while in mush and then 'lpr' and nothing would 
print out.  Can anyone explain this?
-- 

Thanks,

Tony

schaefer@CSE.OGI.EDU (Barton E. Schaefer) (08/01/90)

On Jul 31,  1:16pm, Tony Kanakis wrote:
} Subject: mush 'cmd' use
}
} _____________________________________________________________________________
} cmd two 'set print_cmd="enscript -b'TO:  CUST. SUP.'-fCourier10 -Plaser2; lpq -Plaser2"'
} _____________________________________________________________________________
} 
} 	I would type in 'two' while in mush and then 'lpr' and nothing would 
} print out.  Can anyone explain this?

It might have something to do with the four single quotes I see in that
particular line.  When in doubt, check your quote marks!  Unbalanced or
incorrectly nested quotes are the most common reason I've seen for cmds
not working (both my own and ones that other people send me :-).

The parse of that line is (newlines between words):

    cmd
    two
    'set print_cmd="enscript -b'TO:
    CUST.
    SUP.'-fCourier10 -Plaser2; lpq -Plaser2"'

which installs the cmd as

  set print_cmd="enscript -bTO: CUST. SUP.-fCourier10 -Plaser2; lpq -Plaser2"

which will call enscript as

    enscript
    -bTO:
    CUST.
    SUP.-fCourier10
    -Plaser2

In summary, I think you want slightly different quoting and a space
before the -f (backslashed-newlines for readability):

    cmd two \
    'set print_cmd="enscript -b'"'TO:  CUST. SUP.'"' -fCourier10 -Plaser2;\
    lpq -Plaser2"'

-- 
Bart Schaefer						schaefer@cse.ogi.edu