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)
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)
Hi,
Below is my script which creates a file:
#!/bin/sh
if
then
echo "Enter bill period "
echo "Syntax: sh cpd.sh G08"
exit
fi
sqlplus uname/pwd@dbname <<EOF
set WRAP off
set FEEDBACK off
set PAGESIZE 0
set VERIFY off (14 Replies)
ps -eaf | grep “oracleTRLV (LOCAL=NO)” | while read ora_proc
do
echo $ora_proc
done
I would like to modify the above shell so that if character 13 and 14 equal "12" to do something.
Sorry I'm new to shell:( (14 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 Experts,
I'm having issue in assigning var with special character , please see below for complete details.
$ echo $SHELL
/bin/csh
$ cat bp
abd/asd/a
$ awk -F "/" '{print $NF}' bp | awk '{print $1}'
a
$ set a=`awk -F "/" '{print $NF}' bp | awk '{print $1}'`
$ echo $a ... (15 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)
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)