From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: Christian Grothaus Message-ID: <3d638508_2@news.uni-bielefeld.de> Content-Transfer-Encoding: 7BIT References: <02082019184300.00575@localhost.localdomain> Subject: Re: [9fans] rewriting scripts for rc Date: Wed, 21 Aug 2002 12:20:57 +0000 Topicbox-Message-UUID: df0ff926-eaca-11e9-9e20-41e7f4b1d025 Andrey S. Kukhar wrote: > [-- text/plain, encoding 8bit, 4 lines --] > folks, can you help me with rewriting a few Bourne shell scripts for rc > thanks, > -ask > [-- application/x-shellscript, encoding base64, 22 lines, name: nom --] > [-- application/x-shellscript, encoding base64, 9 lines, name: cal_today --] Hello Andrey, you probably got already some solutions. Here are mine (not testet intensively). Hope they work! Christian --- cal_today -------------------------8<-------------------------------- #!/bin/rc switch ($#*) { case 0; *=`{date} cal | sed -e 's/^/ /' -e 's/ '^$3^'$/>'^$3^''^$3^'8------------------------------- #!/bin/rc temp=/tmp/NOM$pid stat=1 fn sigexit sigint sighup sigterm { rm -f $temp exit $stat } switch ($*) { case ''; echo Usage: `{basename $0} pattern >[1=2] exit case */*; echo `{basename $0} 'quitting: I can''t handle /s.' >[1=2] exit } echo $* | tr ' ' '\012' | sort > $temp ls | comm -23 - $temp stat=0 --- nom (without using a temporary file) -------------------------------- #!/bin/rc switch ($*) { case ''; echo Usage: `{basename $0} pattern >[1=2] exit case */*; echo `{basename $0} 'quitting: I can''t handle /s.' >[1=2] exit } comm -23 <{ls} <{echo $* | tr ' ' '\012' | sort} --------------------------------------->8--------------------------------