xref: /freebsd/tests/sys/cddl/zfs/bin/zpool_bsd.ksh (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
1#!/usr/local/bin/ksh93 -p
2#
3
4# $FreeBSD$
5
6cmd=$1
7
8if [[ -z $cmd ]]; then
9	return 0
10fi
11
12shift
13
14
15typeset option
16case $cmd in
17	create|add|attach|detach|replace|remove|online|offline|clear)
18		for arg in $@; do
19			if [[ $arg == "/dev/"* ]]; then
20				arg=${arg#/dev/}
21				arg="/dev/"$arg
22			fi
23			if [[ $arg == "/dev/"* ]]; then
24				echo $arg | egrep "*s[0-9]$" > /dev/null 2>&1
25				if [ $? -eq 0 ]
26				then
27					n=`echo $arg| wc -c`
28					set -A map a b c d e f g h i j
29					s=`echo $arg | cut -c $((n-1))`
30					arg=${arg%s[0-9]}${map[$s]}
31				fi
32			fi
33
34			option="${option} $arg"
35		done
36		;;
37	*)
38		option="$@"
39		;;
40esac
41
42echo $cmd $option
43