Results 1 to 3 of 3

Thread: [SOLVED] Bash Script Help

  1. #1
    clayway's Avatar
    clayway is offline Active Member
    Join Date
    Feb 2007
    Location
    Dallas, TX
    Posts
    39
    Rep Power
    8

    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...

    #!/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

  2. #2
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    To escape out use a backslash '\' and you can enclose the whole folder within quotes " I believe.

  3. #3
    clayway's Avatar
    clayway is offline Active Member
    Join Date
    Feb 2007
    Location
    Dallas, TX
    Posts
    39
    Rep Power
    8

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 658
    Last Post: 04-04-2014, 09:01 AM
  2. Replies: 210
    Last Post: 01-17-2012, 01:19 AM
  3. Zimbra Open Source Backup Help
    By ayush1440 in forum Administrators
    Replies: 8
    Last Post: 11-13-2008, 04:56 AM
  4. how to launch a (bash) script at user login?
    By shadowscheme in forum Administrators
    Replies: 4
    Last Post: 11-04-2007, 05:13 AM
  5. Replies: 0
    Last Post: 10-31-2007, 07:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •