T
T
ToPneDoll2017-09-28 10:51:13
linux
ToPneDoll, 2017-09-28 10:51:13

How to run a bash script that starts another program?

#!/bin/bash
zmprov ca [email protected] Managers
zmprov sp [email protected] $2
zmmailbox -z -m [email protected] createFolder /Inbox/Facebook
zmmailbox -z -m [email protected] createFolder /sent/office 
zmmailbox

and then the script is not executed, because there is a transition to the mailbox, and I need to execute further commands inside zmmailbox
aa -u https://zimbra.jo admin adminadmin
selectmailbox $1
addFilterRule rule1 address "test1" all not_is "@domain"  fileinto /inbox/office

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2017-09-28
@ToPneDoll

Create a separate list of commands for zmmailbox, don't forget to add exit or quit at the end so bash can continue and run it like this using the document here construct:

zmmailbox <<EOF
aa -u https://zimbra.jo admin adminadmin
selectmailbox $1
addFilterRule rule1 address "test1" all not_is "@domain" fileinto /inbox/office 
exit
EOF

P
pfg21, 2017-09-28
@pfg21

I understand the correct question is "how to run the script on behalf of another system user ??"
then
sudo -u %user% sh script.sh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question