代码如下:
#! /bin/bash
read -p “input your txt:” txt
read -p “input your file name:” name
echo ${txt} > ${name}
Linux编写shell脚本,要求用户输入一串字符,并写入一个文件,文件名由用户输入。
于 2020-12-20 21:17:28 首次发布
代码如下:
#! /bin/bash
read -p “input your txt:” txt
read -p “input your file name:” name
echo ${txt} > ${name}