[PLUG] "date" output cli/bash inconsistency

Steven Raymond stever at woo-hoo.com
Sat Aug 2 17:09:01 UTC 2003


Can someone please explain why the same command executed from the command
line vs. in a bash script, would output differently:

[root at sparky log]# echo $SHELL
/bin/bash
[root at sparky log]# cat rejectmail.sh
#!/bin/bash
TODAY=`date -d "8/1/2003" "+%b %e"`
echo $TODAY

[root at sparky log]# ./rejectmail.sh
Aug 1
[root at sparky log]# date -d "8/1/2003" "+%b %e"
Aug  1
[root at sparky log]#


Note I want the latter output, "Aug  1" (note with two spaces).  The %e
switch with date command does exactly what I want from the command line,
but acts differently when run from a script.  Why is that?  Apparently
enclosing the command in `` makes it act differently.

Thanks!






More information about the PLUG mailing list