LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Seeking advice on script (https://www.linuxquestions.org/questions/programming-9/seeking-advice-on-script-239058/)

satimis 10-05-2004 11:04 AM

Seeking advice on script
 
Hi folks,

I have following script saved to /usr/sbin/make_iso_file

1)
Code:

function make_iso_file ()
{
    # initialize the following loop
    # we're going to build the args to mkisofs, set it to the empty string
    mkisofs_args="-R -o Image.iso -J -hide-rr-moved Document=/home/satimis/Document Photo=/home/satimis/Photo"
    # and set the paths variable to all the remaining command-line arguments
    paths="$@"
    # and now iterate through all paths given on the command-line
    for path in $paths
    do
        # for each path given, add the appropriate graft-point to mkisofs's arguments
        mkisofs_args="${mkisofs_args} ${path##*/}=${path}"
    done

    # and now call mkisofs
    mkisofs $mkisofs_args
}


2)
My goal is to create an ISO image applying following command line

# mkisofs -R -o Image.iso -J -hide-rr-moved Document=/path/to/Document Photo=/path/to/Photo"

from following directories;
Document=/path/to/Document
Photo=/path/to/Photo

plus argument for adding further directories with variated path, such as

dir-A=/path/to/dir-A
dir-B=/path/to/dir-B
etc.

which are added during executing the file "make_iso_file"

3)
# chmod +x /usr/sbin/make_iso_file

4)
# /usr/sbin/make_iso_file
/usr/sbin/make_iso_file: line 15: unexpected EOF while looking for matching `''
/usr/sbin/make_iso_file: line 22: syntax error: unexpected end of file

Kindly advise how to fix the problem. TIA

B.R.
satimis

Hko 10-05-2004 03:02 PM

Is that your entire script?
You need at least actually call the function by adding as the last line:

make_iso_file $@


All times are GMT -5. The time now is 09:33 PM.