How to protect > and interpret it later on? (w/o using eval)
From:
Peng Yu
Subject:
How to protect > and interpret it later on? (w/o using eval)
Date:
Fri, 2 Dec 2011 00:24:08 -0600
Hi,
~$ cat ../execute.sh
#!/usr/bin/env bash
echo ===="$@"
"$@"
$ ../execute.sh ls >/tmp/tmp.txt
$ cat /tmp/tmp.txt #I don't want "====ls" be in the file
====ls
main.sh
'>' will not work unless eval is used in execute.sh.
$ ../execute.sh ls '>' /tmp/tmp.txt
====ls > /tmp/tmp.txt
ls: cannot access >: No such file or directory
/tmp/tmp.txt
How to make execute protect > and interpret it later on w/o using eval?
--
Regards,
Peng