xref: /freebsd/contrib/dialog/samples/rotated-data (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#!/bin/sh
2# $Id: rotated-data,v 1.2 2019/12/10 23:59:24 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