Shell 大小写
tags: 艺术
文章目录
- Shell 大小写
-
- 1. 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