firstfunc.ksh

来自「Solaris环境下Shell编程编程」· KSH 代码 · 共 44 行

KSH
44
字号
#!/bin/ksh# Purpose: To parse a long pathname.## Name: firstfunc.kshfunction parsepath{   name=$1   print   print "The pathname is: $name"   while [[ -n $name ]]   do      print $name      name=${name%/*}   done   print}if [ $# -ne 0 ]; then   echo "Usage: firstfunc"   exit 1fiprint -n "Enter a pathname and I will parse it: [Control-D to quit]: "read pathname junkwhile [[ -n $pathname ]]do   parsepath $pathname   # Enter a control-D to quit   print -n "Enter a pathname and I will parse it: [Control-D to quit]: "   read pathname junkdone

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?