xref: /freebsd/contrib/dialog/samples/rotated-data (revision d8a0fe102c0cfdfcd5b818f850eff09d8536c9bc)
1#!/bin/sh
2# $Id: rotated-data,v 1.1 2004/12/19 16:43:47 tom Exp $
3# Rotate the second parameter's data by the given shift count.
4if test $# != 0
5then
6	case $1 in
7	[1-9]*)
8		left=$1
9		next=`expr $left + 1`
10		shift 1
11		;;
12	*)
13		left=1
14		next=2
15		;;
16	esac
17	char=`echo "$@" | cut -b -${left}`
18	data=`echo "$@" | cut -b ${next}-`
19
20	printf "%s%s\n" $data $char
21else
22	echo
23fi
24