escape(1) Mail Avenger 0.8.3 escape(1)NAME
escape - escape shell special characters in a string
SYNOPSIS
escape string
DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result.
EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string:
$ var='; echo gotcha!'
$ eval echo hi $var
hi
gotcha!
$
Using escape, one can avoid executing the contents of $var:
$ eval echo hi `escape "$var"`
hi ; echo gotcha!
$
A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For
example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient:
#!/bin/sh
formail -x to -x cc -x resent-to -x resent-cc
| fgrep "$1" > /dev/null
&& exit 0
echo "<$1>.. address does not accept blind carbon copies"
exit 100
To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt
script:
bodytest reject_bcc `escape "$RECIPIENT"`
SEE ALSO avenger(1),
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 escape(1)
Check Out this Related Man Page
escape(1) Mail Avenger 0.8.3 escape(1)NAME
escape - escape shell special characters in a string
SYNOPSIS
escape string
DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result.
EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string:
$ var='; echo gotcha!'
$ eval echo hi $var
hi
gotcha!
$
Using escape, one can avoid executing the contents of $var:
$ eval echo hi `escape "$var"`
hi ; echo gotcha!
$
A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For
example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient:
#!/bin/sh
formail -x to -x cc -x resent-to -x resent-cc
| fgrep "$1" > /dev/null
&& exit 0
echo "<$1>.. address does not accept blind carbon copies"
exit 100
To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt
script:
bodytest reject_bcc `escape "$RECIPIENT"`
SEE ALSO avenger(1),
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 escape(1)
Can anyone please tell me why this wont work! Thanks so much!
#!/bin/sh
for file
do
case $file in
*.*.*)
echo Cannot have more than 1 dot
exit
;;
*'**'*)
echo Cannot have more than 1 asterisk
exit
;;
*'*'*|?.)
echo this is a target (19 Replies)
I want to write a shell script in order to retreive some data from a log file that i have written into.
The string that i want to get is the number 2849 (that is located between | | ).
To explain further, this is the result i get after running "grep LOGIN filename.log" but i need to get the... (25 Replies)
Im trying to get the frist two line of a file as a variables.
input file
/tmp/tmp.txt
1226037463l
1226037422ll
while read -r LINE
do
if ;
then
FRIST=`echo $LINE | awk -F"|" 'NR==1''{print $1}'`
echo $FRIST
SECOND=`echo $LINE | awk -F"|"... (37 Replies)
Is there an option for negation in the "tr" command?
For eg:
echo hi | tr "h" "i"
will print "ii".
But if I want to covert all characters that are not "h" to "j", how do I do that?
Is there something like "!" in tr? Or any switch?
Thanks,
Prasanna (17 Replies)
Hi,
I need a unix script to look at a "test1.txt" and the txt file will look like this...
QUEUE(QM1.DEAD.LETTER.QUEUE) TYPE(QLOCAL)
CURDEPTH(0)
QUEUE(TEST.REQ.Q) TYPE(QLOCAL)
CURDEPTH(0)
QUEUE(PRFM.REQ.Q) TYPE(QLOCAL)
CURDEPTH(0)
If the value is... (26 Replies)
Hi,when I run my first shell script,I got something that doesn't work right.
I wrote this code in the script.
echo -e "Hello,World\a\n"But the screen print like this:
-e Hello,World
The "-e" wasn't supposed to be printed out.
Can anyone help me out?:wall:
Many thanks!:) (25 Replies)
Sorry folks, Second time today.
I am working on a script that accepts data via pipe and processes it.
I expect it to work as:
# command | ProcScript.sh
Within ProcScript.sh, I want to be able to give the target of the prev run command
I am using history 2 | grep -v history | awk... (18 Replies)
Hi,
I have this command in a shell script and I can get it to echo ok, but when I try to execute the command I get a "file not found" error. Which is strange because, if I copy and paste the same command at the cli it works ok.
What am I doing wrong please? (16 Replies)
Hi All ,
I have the following script as below , I tried to modify to meet the requirement , could someone help ? very thanks
================================================================================================
while read STR NAME; do
Total=0
MyString="$STR"
GetData () {... (18 Replies)
Behavior I am looking for:
$ for var in a 'b c'; do echo $var; done
a
b c
What I am getting when I try to use a variable:
$ test="a 'b c'"
$ for var in $test; do echo $var; done
a
'b
c'
Is there a workaround?
Mike (16 Replies)
Hi
I want to check delimiter in file. Delimiter in my file is ~|*
sample of file :
ABC~|*edgf~|*T1J333~|*20121130
ABC~|*sdaf~|*T1J333~|*20121130
ABC~|*fsdg~|*T1J333~|*20121130
ABC~|*dfsg~|*T1J333~|*20121130
in this i want to count number delimiter occur is 4 in each row if count is... (21 Replies)
Hi
i had written one script,it sends email from terminal and mine script is as:
#!/bin/bash
SUBJECT="linux mail send attachment example"
BODY_FILE="/home/sreenivasa/Desktop/Testing.txt"
#ATTACHMENT_FILE="/home/sreenivasa/Desktop/Dataset.zip"... (23 Replies)