Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

escape(1) [opensolaris 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)

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)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bourne Shell Scripting CRISIS

:( :( :( G'day all This is a desperate call to those out there who know anything about Bourne Shell scripting, as I'm in the middle of a crisis Pleae E-Mail me if you believe you can help (No spamming please) The sooner the better, if you're an aussie that lives in Victoria, I'll even... (20 Replies)
Discussion started by: Aussie_Bloke
20 Replies

2. Shell Programming and Scripting

Case Statement

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)
Discussion started by: Zeta_Acosta
19 Replies

3. Shell Programming and Scripting

Need help to extract a string delimited by any special character

I have a string as follows IS*blahblah TED~blahblah etc. I want to list down only IS and TED Can someone help me? (24 Replies)
Discussion started by: kumariak
24 Replies

4. Shell Programming and Scripting

Retreive string between two chars

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)
Discussion started by: danland
25 Replies

5. Shell Programming and Scripting

second line of the file

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)
Discussion started by: meetmano143
37 Replies

6. Shell Programming and Scripting

Extract 2 or more int from the text with delimiter.

Hi All, I want to extract the integers from the each line, each line may have 2 or more integers. The following command is appending each integers. echo "Hi I am 100, my friend is 500, his friend is 423" | sed "s///g" 100500423 I need to have delimiter "|" between the integers. If anyone... (18 Replies)
Discussion started by: sarwan
18 Replies

7. Shell Programming and Scripting

Negation in "tr"

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)
Discussion started by: prasanna1157
17 Replies

8. Shell Programming and Scripting

Unix script help

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)
Discussion started by: everurs789
26 Replies

9. Shell Programming and Scripting

echo doesn't work right

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)
Discussion started by: Demon
25 Replies

10. Shell Programming and Scripting

Can anyone find the mistake in this script file

#!/bin/ksh db_user=`echo $DB_USER_NAME` db_pwd=`echo $DB_PASSWORD` db_sid=`echo $TWO_TASK` sqlplus -s $db_user/$db_pwd@$db_sid << EOF a = select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and bus_event_seq_nbr='3969094' set -- echo $a |... (17 Replies)
Discussion started by: rkrish
17 Replies

11. Shell Programming and Scripting

Echoing command results

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)
Discussion started by: Marc G
18 Replies

12. UNIX for Dummies Questions & Answers

I want to compare to alphanumeric value in a unix shell script.

#!/bin/sh b= SERVER if ; then echo "hostname $a is same" ____________________________ (17 Replies)
Discussion started by: Nsharma3006
17 Replies

13. Shell Programming and Scripting

Calculate the total

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)
Discussion started by: ust3
18 Replies

14. Shell Programming and Scripting

Count delimiter(~|*) each row in a file and return 1 or 0

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)
Discussion started by: MOHANP12
21 Replies

15. Shell Programming and Scripting

Automating Mail Process

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)
Discussion started by: rajnikant
23 Replies