The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
printf arunviswanath High Level Programming 2 09-19-2007 10:31 PM
the printf command bebop1111116 Shell Programming and Scripting 4 10-01-2006 01:40 AM
find: problems escaping printf-command string grahamb Shell Programming and Scripting 1 12-04-2005 04:00 PM
need help with printf command nymus7 Shell Programming and Scripting 1 04-21-2005 08:05 PM
printf command FIRE Shell Programming and Scripting 2 08-07-2002 03:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-21-2005
cin2000 cin2000 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 30
printf command in ksh

Hi,
I am very confused with my printf command.
Somehow one variable can't line up with others...

newstart2 ="Mon Nov 11 01 00:00:00 2002"
printf "%-20s" $newstart2

Here is the output:
Mon Nov 11
01 00:00:00 2002


It spread out to two lines..

Why?
  #2 (permalink)  
Old 12-21-2005
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,800

Code:
#!/bin/ksh

newstart2="Mon Nov 11 01 00:00:00 2002"
printf "%-30s\n" "$newstart2"

$newstart2 without the quotes becomes a list of separate arguments for printf because a space is what printf wants to see between arguments.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0