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