shell 大写转小写

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

猜你喜欢

转载自blog.csdn.net/xixihahalelehehe/article/details/125163397