Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

avoid eval?



func ()

{

    sstring="$@"
    eval cp oldfile \""${(f)sstring}"\"

}

$ func now is the time

$ func filenames should not have spaces
'oldfile' -> 'filenames should not have spaces'

It's easy enough if there are no spaces in the target name, but I don't seem to be able to avoid the 'eval' construction if there are spaces.  Is there a simpler way to simulate quotation marks:

$ cp oldfile "now is the time"

... within the function?  The way I have it is surely a bit abominable, somehow 'cp' needs to know that "now is the time" is one argument.  I should know this.




Messages sorted by: Reverse Date, Date, Thread, Author