zsh-users
 help / color / mirror / code / Atom feed
* avoid eval?
@ 2018-03-11 20:48 Ray Andrews
  2018-03-11 22:53 ` Marc Chantreux
  0 siblings, 1 reply; 9+ messages in thread
From: Ray Andrews @ 2018-03-11 20:48 UTC (permalink / raw)
  To: Zsh Users

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.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-13 22:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 20:48 avoid eval? Ray Andrews
2018-03-11 22:53 ` Marc Chantreux
2018-03-12  0:43   ` Ray Andrews
2018-03-13  2:13     ` Ray Andrews
2018-03-13  2:17       ` Eric Cook
2018-03-13 16:36       ` (some tips about variables) " Marc Chantreux
2018-03-13 17:50         ` Ray Andrews
2018-03-13 20:39           ` Marc Chantreux
2018-03-13 21:50             ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).