printf and echo are not substitutes for each other, they work very different ways. echo just prints what you give it, printf can format it in various ways.
If you want to print several newlines, printf is a good bet. You don't get echo -e everywhere, but printf works nearly the same way wherever you go.
If you want to print a string without a newline, printf can do that everywhere too. printf "%s" "mystring"
If you want to format numbers, printf can also do that for you.
In fact it can do quite a few things, more than I have time to mention here. See man printf for details.
printf and echo are not substitutes for each other, they work very different ways. echo just prints what you give it, printf can format it in various ways.
If you want to print several newlines, printf is a good bet. You don't get echo -e everywhere, but printf works nearly the same way wherever you go.
If you want to print a string without a newline, printf can do that everywhere too. printf "%s" "mystring"
If you want to format numbers, printf can also do that for you.
In fact it can do quite a few things, more than I have time to mention here. See man printf for details.
Is there a way where I can combine the floating point number scale along with the string formatting, something like below
Hi All,
need help with reading the array and sum of the array elements.
given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.
Input Format
The first line of the input consists of an... (1 Reply)
Dear users,
I have Linux server whose versions are Suse 10 SP 3 and Suse 11.
I am trying to send email from these servers to my GroupWise email account.
In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Hi,
I have one requirement to send email to email id which is having # ( in the begining of the email id).
I'm using mailx command to send an email. But not receiving those emails, but email status is showing email sent successful.
Code which i'm using is :
cat file1.txt | mailx -s... (3 Replies)
hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version).
i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010).
a. i cant see a list of the contacts,... (0 Replies)
Hello ,
I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them .
I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Hello everyone
I have a problem and I need your help:
I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server.
I need send an email from Solaris servers preferably using Centos4 email server.
I have no mail service configured in my Solaris computers (1 Reply)
Hi All,
How do I send an email using malix where email address contains a #.
I have a email address like this : #test@test.com
I want to send email like malix -s "TEST" #test@test.com < SOMEFILE
I tried \# but doesn't work. Please let me know how we can achieve this?
I am in... (1 Reply)
Hi
A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as
" usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)