slicing the date

noe at s.cs.uiuc.edu noe at s.cs.uiuc.edu
Thu Mar 30 09:01:00 AEST 1989


Maybe expr will work?  Again, it's going to look sort of hideous, but it should
work.  For example, if date produces "Wed Mar 29 16:57:30 1989" then
	NOW=`date`
	PS1=`expr "$NOW" : '... ... \(..\)'`
would set PS1=29, the day of the month.  This is Bourne shell, by the way, and
would also work in Kourne shell (-: but not C-shell.  I assume anyone forcibly
removed from a System V environment at least has the good sense to avoid csh
like the plague.



More information about the Comp.unix.questions mailing list