Welcome, Guest
Username Password: Remember me

Difference between echo and printf in unix
(1 viewing) (1) Guest
Shell Script
  • Page:
  • 1

TOPIC: Difference between echo and printf in unix

Difference between echo and printf in unix 1 year, 4 months ago #525

  • scmuser
  • OFFLINE
  • Gold Boarder
  • scm master
  • Posts: 237
  • Points: 3429
  • Karma: 0
  • Honor Medal 2009
Hi,

What are the differnece between echo and printf in unix/ Linux while using in shell scripting or command line?

Re: Difference between echo and printf in unix 1 year, 4 months ago #526

  • rajeshkumar
  • OFFLINE
  • Moderator
  • I love software configuration management
  • Posts: 370
  • Points: 44589
  • Karma: 4
  • Honor Medal 2009
printf can do everything what echo can does with some basic difference.

echo is legacy and printf is recently introduce.
echo is in built in all shell but printf is built-in only in bash shell
printf also uses formatted stgrings in the same way the C language function of the same name uses them.

but
Echo - displays the output as such and it is comparatively faster than printf.
Regards,
Rajesh Kumar
Build and Release Engineer
My Blog: community.scmgalaxy.com/pg/profile/rajeshkumar
  • Page:
  • 1
Time to create page: 0.58 seconds

     
    
Home Forum