bash problem


Results 1 to 2 of 2

Thread: bash problem

  1. #1
    Join Date
    Oct 2012
    Posts
    1

    bash problem

    Hi,

    I have a little problem with bash that I hope someone can help me with.

    I have a utility program that I made that use the following syntax:

    mdb tag -z -d /path/to/some/directory -d "/path/to/some/other/directory with space" -d /yet/another/one

    Now I want to wrap it in a nautilus script

    So far I have this:

    Code:
    IFS=$'\n';
    
    for d in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
    do
        ARGS="${ARGS} -d \"${d}\"";
    done;
    
    mdb tag -z ${ARGS}
    however my script report receiving only one argument, which is all the -d enclosed in double quotes

    That is the command is launched as :

    mdb tag -z " -d dir1 -d dir2 -d dir3"
    while I want
    mdb tag -z -d "dir1" -d "dir2" -d "dir3"

    any ideas?

  2. #2
    Join Date
    May 2002
    Posts
    1,254
    Looks ok except for some reason the IFS as a newline does not seem to be working. Another method would be to use the standard bash argument variables and iterate through the list with a shift

Posting Permissions

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