Shell 大小写

1. Shell 大写转小写

$ cat test
ABC
  • convertlowercase.sh
#!/usr/bin/env bash

echo -n "Enter File Name: "
read -r file

if [ ! -f "$file" ]; then
        echo "Filename $file does not exists"
        exit 1
fi

tr '[:upper:]' '[:lower:]' < "$file"

执行:

$ bash convertlowercase.sh
Enter File Name: test
abc
Copyright © ghostwritten 浙ICP备2020032454号 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-06-22 16:15:13

results matching ""

    No results matching ""