# ------------------------------------------------------
# 英字で始まる英数字を echo
# 第一引数 : 桁数
# ------------------------------------------------------
function __f_l_mk_ID()
{
local T=
local B=
local C=${1:-8}
# 数字か?
printf "%d" $C 2>/dev/null >&2
[[ $? -ne 0 ]] && return 1
if [[ $C -gt 1 ]] ; then
C=$(( C - 1 ))
T=$(env LANG=C /usr/bin/tr -dc A-Z < /dev/urandom | /usr/bin/head -c 1)
B=$(env LANG=C /usr/bin/tr -dc A-Z0-9 < /dev/urandom | /usr/bin/head -c $C)
echo "$T$B"
fi
return 0
}
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme