⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cvt.sh

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SH
字号:
#!/bin/bash#  cvt.sh:#  Converts all the MacPaint image files in a directory to "pbm" format.#  Uses the "macptopbm" binary from the "netpbm" package,#+ which is maintained by Brian Henderson (bryanh@giraffe-data.com).#  Netpbm is a standard part of most Linux distros.OPERATION=macptopbmSUFFIX=pbm          # New filename suffix. if [ -n "$1" ]then  directory=$1      # If directory name given as a script argument...else  directory=$PWD    # Otherwise use current working directory.fi    #  Assumes all files in the target directory are MacPaint image files,#+ with a ".mac" filename suffix.for file in $directory/*    # Filename globbing.do  filename=${file%.*c}      #  Strip ".mac" suffix off filename                            #+ ('.*c' matches everything			    #+ between '.' and 'c', inclusive).  $OPERATION $file > "$filename.$SUFFIX"                            # Redirect conversion to new filename.  rm -f $file               # Delete original files after converting.     echo "$filename.$SUFFIX"  # Log what is happening to stdout.doneexit 0# Exercise:# --------#  As it stands, this script converts *all* the files in the current#+ working directory.#  Modify it to work *only* on files with a ".mac" suffix.

⌨️ 快捷键说明

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