|
Prev: How to list all active local ports where a server/services islistening?
Next: cmd1 | gzip -f ... && cmd2 : Command concatenation with condition: Execute cmd2 only if cmd1 (or gzip) fails/succeeds?
From: Gary Williamson on 17 Jun 2008 02:09 In a shell script I want to echo out some values whcih are not necessarily as wide as they should be. For example a value of 7 should be display as a field of width 4 with left padded zeros "0": 0007 How can I accomplish this? Gary
From: Bill Marcum on 17 Jun 2008 03:20
["Followup-To:" header set to comp.unix.shell.] On 2008-06-17, Gary Williamson <garywill(a)usca.edu> wrote: > > > In a shell script I want to echo out some values whcih are not > necessarily as wide as they should be. > > For example a value of 7 should be display as a field of width 4 with > left padded zeros "0": > > 0007 > > How can I accomplish this? > > Gary printf "%04d\n" 7 |