首页 > 解决方案 > 从读取行创建文件的 Bash 脚本

问题描述

我正在尝试创建一个新文件来保存函数的结果。我要求提供文件名以进行交互。但是,我不知道如何用这个名称创建一个新文件来保存结果。不起作用的脚本是这样的:

if [ -f "$3" ]
then
echo "Give a name for the new file: "
read $arch
changefunction $1 $2 $3 > "${arch}"

我试过 > $arch ; > ${arch} 但我想我不知道正确的写法非常感谢!!

标签: shellfilesh

解决方案


我在这里更正了

if [ -f "$3" ]
then
echo "Give a name for the new file: "
read arch
changefunction $1 $2 $3 > ${arch}

推荐阅读