?? cvt.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 + -