2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

macOSのバージョンのニックネームを表示(シェルスクリプト)

Last updated at Posted at 2021-02-15

こんにちは。
macOS のバージョンのニックネームを表示させました1

$ ./macos_ver.sh 
10.14.6 macOS Mojave
$ ./macos_ver.sh 10.15
10.15 macOS Catalina
macos_ver.sh
#!/bin/sh
ver="$1"
[ -z "$ver" ] && ver=$(sw_vers -productVersion)
printf "%s " "$ver"
case "$ver" in
  14*)    echo "macOS Sonoma";;
  13*)    echo "macOS Ventura";;
  12*)    echo "macOS Monterey";;
  11*)    echo "macOS Big Sur";;
  10.15*) echo "macOS Catalina";;
  10.14*) echo "macOS Mojave";;
  10.13*) echo "macOS High Sierra";;
  10.12*) echo "macOS Sierra";;
  10.11*) echo "OS X El Capitan";;
  10.10*) echo "OS X Yosemite";;
  10.9*)  echo "OS X Mavericks";;
  10.8*)  echo "OS X Mountain Lion";;
  10.7*)  echo "Mac OS X Lion";;
  10.6*)  echo "Mac OS X Snow Leopard";;
  10.5*)  echo "Mac OS X Leopard";;
  10.4*)  echo "Mac OS X Tiger";;
  10.3*)  echo "Mac OS X Panther";;
  10.2*)  echo "Mac OS X Jaguar";;
  10.1*)  echo "Mac OS X Puma";;
  10.0*)  echo "Mac OS X Cheetah";;
  *) echo ;;
esac; 
exit
  1. sw_versコマンド(print Mac OS X operating system version information)だけではニックネームは表示しません。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?