PageRenderTime 12ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/dialog/samples/rotated-data

https://bitbucket.org/freebsd/freebsd-head/
Shell | 23 lines | 19 code | 1 blank | 3 comment | 1 complexity | 60856cbe643ed2fa7ba0d34b8016cbc7 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause, LGPL-2.0, LGPL-2.1, BSD-2-Clause, 0BSD, JSON, AGPL-1.0, GPL-2.0
 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