Difference between revisions of "GSDP:GAM100/API/Code"

From Inside
Jump to: navigation, search
(asdf)
 
(SyntaxHighlight lang=bash junk)
Line 1: Line 1:
 
asdf
 
asdf
 +
 +
<SyntaxHighlight lang=bash>
 +
cya_init="spawn sudo su - cyrusadmin; expect -re \"cyradm>\"; send \"connect localhost\n\"; "
 +
cya_exit="expect -re \"localhost>\"; send \"exit\n\"; sleep 0.1; "
 +
function cyradm.Auto { expect -c "$cya_init $cya_auth $cya_null $1 sleep 0.1; $cya_null $cya_exit " ;} # Wrapper
 +
function cyradm.lamB { cyradm.Auto "send \"lam \\\"$1\\\"\n\";" ;} # Bad looking output
 +
function cyradm.lam { out=$( echo $(cyradm.lamB "$1" | cat -v | grep "> lam \| lrs\|not exist" | sed 's%\^M%%g;s%localhost> lam %%' )) ; if [[ "$out" == *"Mailbox does not exist" ]] ; then cyradm.cm "$1" ; cyradm.lam "$1" ; else echo "$out" ; fi ;} # If Mailbox does not exist then create it.
 +
function cyradm.samG { cyradm.Auto "send \"sam \\\"$1\\\" $2 lrs\n\";" | grep "BeQuiet" ;} # Grant Read Only
 +
</SyntaxHighlight>
 +
 +
Hay doing thing:
 +
: <code><nowiki>me@here:~$ execute things</nowiki></code>

Revision as of 19:27, 13 April 2018

asdf

 cya_init="spawn sudo su - cyrusadmin; expect -re \"cyradm>\"; send \"connect localhost\n\"; " 
 cya_exit="expect -re \"localhost>\"; send \"exit\n\"; sleep 0.1; " 
 function cyradm.Auto { expect -c "$cya_init $cya_auth $cya_null $1 sleep 0.1; $cya_null $cya_exit " ;} # Wrapper 
 function cyradm.lamB { cyradm.Auto "send \"lam \\\"$1\\\"\n\";" ;} # Bad looking output 
 function cyradm.lam { out=$( echo $(cyradm.lamB "$1" | cat -v | grep "> lam \| lrs\|not exist" | sed 's%\^M%%g;s%localhost> lam %%' )) ; if [[ "$out" == *"Mailbox does not exist" ]] ; then cyradm.cm "$1" ; cyradm.lam "$1" ; else echo "$out" ; fi ;} # If Mailbox does not exist then create it. 
 function cyradm.samG { cyradm.Auto "send \"sam \\\"$1\\\" $2 lrs\n\";" | grep "BeQuiet" ;} # Grant Read Only

Hay doing thing:

me@here:~$ execute things
Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>