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

delay argument interpretation



I have a shell function 'ask' to aid the interactive command
execution, for example,

	function ask {
		echo -n "$*? [y/n]: "
		read yon
		if [[ "$yon" = "y" ]]; then
			$@
			echo "end of: $@"
			fi
		}

Then I can use commands similar to the one below to interactively
select the desired candidates:

	for i in *.c; do
		ask diff old/$i $i
		done

will work like:

	diff old/a.c a.c? [y/n]: 
	diff old/b.c b.c? [y/n]: 
	diff old/c.c c.c? [y/n]: 

This all work out nice, however, the comment blocks in these files are
different and I would like to apply a filter (rmcmt in the example
below) to it so I will only see the source differences:

	for i in *.c; do
		ask diff =(rmcmt old/$i) =(rmcmt $i)
		done

However the =(...) expanded info a temporary filename and the prompt
became:

	diff /tmp/zshaaqqxa /tmp/zshaaqqxb? [y/n]:
	diff /tmp/zshaaqqxa /tmp/zshaaqqxb? [y/n]:
	diff /tmp/zshaaqqxa /tmp/zshaaqqxb? [y/n]:

What can I do to quote the arguments so it will not expand until
later in function ask?  Any help will be appreciated...



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