Sponsored Content
Top Forums Shell Programming and Scripting Differenc between print and echo Post 302113926 by manoj.rana on Wednesday 11th of April 2007 07:12:38 AM
Old 04-11-2007
print and echo

both echo and print are common in working ...
both displays the chars on the screen or windows.
upto me using print we can redirect the output to any file descriptor
using print -u[n] but for echo we have to redirect using redirection operator
or using pipe.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo or print to screen and file

I did a search for this topic but I couldn't find it and I was sure I have seen something similar before (hard because I am not sure of the criteria for the keywords) What I was looking for was to be able to echo a message to the screen from a bash.sh script at the same time logging it to a... (2 Replies)
Discussion started by: Shakey21
2 Replies

2. UNIX for Dummies Questions & Answers

echo vs. print

Is there a functional difference between echo and print? (1 Reply)
Discussion started by: PhilW
1 Replies

3. Shell Programming and Scripting

how to print backslah using echo

how to print 3 backslah using Unix AIX, i have try in my fedora and AIX,both give dirrent output for same echo statment test.sh sed -e 's/\(\)/\\\1/g' -e 's/\$?/\\$?/g' -e 's/\$#/\\$#/g' -e 's/^/echo "/g' -e 's/$/ "/g' xMNBDF070 > xMNBDF070_test xMNBDF070 sed -e "s/'/\\\'/g" -e... (8 Replies)
Discussion started by: mani_um
8 Replies

4. UNIX for Dummies Questions & Answers

Differenc between ps -ef and top

First of all i really thankful to all those people who have created this site. unix.com rocks man!! I am bit confused about the two commands which are 'top' and 'ps -ef'.:confused: My requirement is that i want to monitor the CPU usage of Operating system and if the CPU usage is more than 90%... (2 Replies)
Discussion started by: Amey Joshi
2 Replies

5. Shell Programming and Scripting

echo/print variable question

while read filer ; do echo $filer $1 $2; ssh $filer vfiler status -r | awk '/running/{host=$1}/Path:/{path=$2;print host,path}'; done < filers.list this will print node1 vfiler0 / vfiler2 /vol/vfiler2_vol0 vfilert /vol/vfiler_vol vfilert /vol/virt_vol where node1 = $filer. however how... (1 Reply)
Discussion started by: riegersteve
1 Replies

6. Shell Programming and Scripting

Print (echo) variable in a single line

Hi, I have written this code ------------------------------------------------ # !/bin/ksh i=0 while do j=$i while do echo -e $j #printf "%d",$j j=`expr $j - 1` done echo i=`expr $i + 1` done ---------------------------------------------------- The ouput which... (2 Replies)
Discussion started by: rac
2 Replies

7. Shell Programming and Scripting

Using echo to print arguments inside a function

I am using echo in bash. Have created a function prargv which takes a number of arguments. Example: prargv "-e" "--examples" Inside prargv, I want to print all the arguments using echo echo "$@" This returns --examples rather than -e --examples" This problem can be fixed... (3 Replies)
Discussion started by: kristinu
3 Replies

8. Shell Programming and Scripting

Replacing echo with print

Hi everyone, I'm executing a shell script and one of the commands is creating a file with text via echo. However, if the text within echo has "\t" or similar, it automatically translates it into a TAB character, same goes for other special characters. I know that if I put another "\"... (7 Replies)
Discussion started by: demmel
7 Replies

9. Shell Programming and Scripting

Use of expr to calc differenc ein to epoch values

Hi folks, I have a script where i am trying to calc the difference between two epoch dates and then have a condition based on the resultant value. When I run the script it keeps complaining; expr: syntax error ./testdiff.sh: line 11: syntax error in conditional expression ./testdiff.sh:... (25 Replies)
Discussion started by: jonnyd
25 Replies

10. Shell Programming and Scripting

Echo print on same line while loop using variable

Currently using below script but echo it print the output in two line. Input file all-vm-final-2.txt CEALA08893 SDDC_SCUN DS_SIO_Workload_SAPUI_UAT_01 4 CEALA09546 SDDC_SCUN DS-SIO-PD5_Workload_UAT_SP1_Flash_07 4 CEALA09702 SDDC_SCUN DS-VSAN-RMP-WORKLOAD01 4 DEALA08762 SDDC_LDC... (3 Replies)
Discussion started by: ranjancom2000
3 Replies
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)
All times are GMT -4. The time now is 09:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy