du.sh

来自「Shall高级编程」· Shell 代码 · 共 30 行

SH
30
字号
#!/bin/bash# Du.sh: DOS to UNIX text file converter.E_WRONGARGS=65if [ -z "$1" ]then  echo "Usage: `basename $0` filename-to-convert"  exit $E_WRONGARGSfiNEWFILENAME=$1.unxCR='\015'  # Carriage return.           # 015 is octal ASCII code for CR.           # Lines in a DOS text file end in CR-LF.           # Lines in a UNIX text file end in LF only.tr -d $CR < $1 > $NEWFILENAME# Delete CR's and write to new file.echo "Original DOS text file is \"$1\"."echo "Converted UNIX text file is \"$NEWFILENAME\"."exit 0# Exercise:# --------# Change the above script to convert from UNIX to DOS.

⌨️ 快捷键说明

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