shell - 从读取行创建文件的 Bash 脚本
问题描述
我正在尝试创建一个新文件来保存函数的结果。我要求提供文件名以进行交互。但是,我不知道如何用这个名称创建一个新文件来保存结果。不起作用的脚本是这样的:
if [ -f "$3" ]
then
echo "Give a name for the new file: "
read $arch
changefunction $1 $2 $3 > "${arch}"
我试过 > $arch ; > ${arch} 但我想我不知道正确的写法非常感谢!!
解决方案
我在这里更正了
if [ -f "$3" ]
then
echo "Give a name for the new file: "
read arch
changefunction $1 $2 $3 > ${arch}
推荐阅读
- nginx - 为每个服务配置不同路径重写的 Kubernetes Traefik Ingress
- c# - Excel 互操作字符串到日期格式
- java - 通过经验点相关性计算数字
- ios - 如何将 UIDocumentPickerViewcontroller 文件上传到 AWS S3 TransferUtility Swift
- csv - 渲染 EJS 视图中的 Mongoose 对象到 CSV
- c# - 获取 maxJsonLength 属性错误
- git - GIT:无法从仓库中删除文件
- ssh - `gcloud app instances ssh` 命令禁用 SSH 主机密钥检查
- codeigniter - 使用 SMTP 发送电子邮件,无需用户名和密码
- r - 如何获得推特句柄列表的点赞数和评论数