Mac に標準搭載されている自動化ツールである Automator を利用します。
コード以外の部分については以下の記事を参照してください。
シェルスクリプト
# フォルダへ移動
cd $1
# ファイル名を入力
filename=$(
osascript -e 'display dialog "ファイル名を入力" default answer ""
set the filename to text returned of the result
return filename'
)
# ファイル名が入力されているかチェック
if [[ $filename = "" ]];
then
osascript -e "display dialog \"ファイル名が空です。\" with title \"エラー\" with icon caution buttons {\"OK\"} default button 1"
exit
fi
# ファイルを作成
touch $filename