home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: printenv Chapter 2
UNIX Commands
Next: Reference: prof
 

printf



printf

 

formats

 [

strings

]

Print strings using the specified formats . formats can be ordinary text characters, C-language escape characters, or more commonly, a set of conversion arguments listed below.

Arguments

%s

Print the next string .

% n $s

Print the n th string .

%[-] m [. n ]s

Print the next string , using a field that is m characters wide. Optionally limit the field to print only the first n characters of string . Strings are right-adjusted unless the left-adjustment flag - is specified.

Examples



printf '%s %s\n' "My files are in" $HOME




printf '%-25.15s %s\n' "My files are in" $HOME


Previous: Reference: printenv UNIX in a Nutshell: System V Edition Next: Reference: prof
Reference: printenv Book Index Reference: prof

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System