I have a bash script that creates a Subversion patch file for the current directory. I want to change it for the zip of the created file if -z given as a script argument.
Here's the relevant part:
zipped='' zipcommand='>' if [ "$1" = "-z" ] then zipped='zipped ' filename="${filename}.zip" zipcommand='| zip >' fi echo "Creating ${zipped}patch file $filename..." svn diff $zipcommand $filename
This does not work because it passes | or > contained in $zipcommand as the svn argument.
I can easily get around this, but the question is whether these types of operators can ever be used when they are contained in variables.
Thanks!
Owen source share