Sample Header Ad - 728x90

Cut command failing

0 votes
1 answer
108 views
We have a ksh Script that is suppose to give the output as last day of the month but when ever we run it we get the below error:
cut: fields are numbered from 1
Try ‘cut —help’ for more information,
I have been trying to debug this but unable to do so. Here is the code:
#!/usr/bin/ksh

if (( $(#)  /dev/null | wc - l)
if (( whencecal != 1 )) ; then print "FATAL: \"cal\" command not found!" ; exit 102 ; fi

typeset -i wrdcount=$(cal ${month} ${year} | sed -e "/^$/ d" | tail -1 | wc -w)
typeset -Z2 momaxdate=$(cal ${month} ${year} | sed -e “/^$/ d” -e “s/[ ][ ]*/,/g” | tail -1 | cut -d”,” -f${wrdcount})

print ${momaxdate}
What can be done to fix this
Asked by ZyPH3R (3 rep)
Aug 20, 2024, 03:01 PM
Last activity: Aug 21, 2024, 07:54 PM