Changes

Printf bash builtin

722 bytes added, 18:52, 9 February 2014
The following lines were added (+) and removed (-):
printf <FORMAT> <ARGUMENTS...>  printf <FORMAT> <ARGUMENTS...> printf "Last name: %s\nName: %s\n" "$SURNAME" "$LASTNAME"  printf "Last name: %s\nName: %s\n" "$SURNAME" "$LASTNAME" echo "Hello World"  echo "Hello World" printf "Hello World\n"  printf "Hello World\n" printf "%s\n" "Hello World"    printf "%s\n" "Hello World"   printf "%s\n" "I have eaten" "the plums" "that were in" "the icebox"  printf "%s\n" "I have eaten" "the plums" "that were in" "the icebox"The following outputs 2 colums of text seperated by tabs.  There is an initial tab, then text, tab, text and linefeed for each line.  Column alignment is only achieved in this case due to the character length of string 1 and 3.  This is not a way to commit columns.  printf "%s\t%s\n" "cannolis" "plums" "guacamole" "tangerine"The next example will create rigid columns of text without regards to the string length so long as the string doesn't exceed the column cell allocation.  It will also assign two formatting variables to contain all the arguments for the sake of readability on the printf statement lines.  The vi editor will be used to place commands within a bash shell script.  SHELL SCRIPT EXAMPLE:
Bureaucrat, administrator
16,192
edits