Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-2009, 10:52 AM
Active Member
 
Posts: 37
Default [SOLVED] Bash Script Help

I know this is not a specific zimbra question, but rather a bash script question involving zimbra.

My company has decided to use a shared email project folder so all team members will have access to the folder.

The script is below and is used to create the shared project folders, assign permissions, and create a default rule for each project number. My problem is the use of long file names in the folder name. I cannot seem to figure out how to escape the spaces in the name and get the script to work. I am just a novice at script writing....so don't kill me over poor script writing habits.

Thanks to all...Zimbra rocks...

Quote:
#!/bin/bash
# 2009-03-01 zimbra folder and permissions creation script.
echo enter job number
read number

echo enter names who need rights
read names

function create {
/opt/zimbra/bin/zmprov sm project.email@example.com gaf

/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/AVL
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/GC
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/HH
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/MEP
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/Structural
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/Civil
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/GeoTech
/opt/zimbra/bin/zmprov sm project.email@example.com cf --view conversation /_Projects/$number/Owner

/opt/zimbra/bin/zmprov sm project.email@example.com gaf
}

function perms {
for i in $names
do
/opt/zimbra/bin/zmprov sm project.email@example.com mfg /_Projects/$number account $i@example.com rwidxa;
done

/opt/zimbra/bin/zmprov sm project.email@example.com gfg /_Projects/$number
}

function rules {
/opt/zimbra/bin/zmprov sm project.email@example.com afrl -l $number active any header "subject" contains $number fileinto /_Projects/$number
/opt/zimbra/bin/zmprov sm project.email@example.com gfrl
}

create
perms
rules

exit 0
__________________
Clay
Reply With Quote
  #2 (permalink)  
Old 03-03-2009, 01:11 PM
Moderator
 
Posts: 7,928
Default

To escape out use a backslash '\' and you can enclose the whole folder within quotes " I believe.
__________________
Reply With Quote
  #3 (permalink)  
Old 03-12-2009, 08:25 PM
Active Member
 
Posts: 37
Default

Uxbod,

Thanks for the reply. Not sure what I am doing wrong, but not having much success with long file names in the bash script. Guess I will try to stay away from long share names for now.

Thanks again.
__________________
Clay
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.