bash后缀输出到控制台的问题

时间:2019-03-26 22:15:01

标签: bash

您好,我目前在bash脚本中遇到问题,我试图根据用户的选择读取和输出带有后缀的文件。选择=应用什么后缀。

代码:

echo 'Input 1, 2, 3 or 4'

read VarChoice

if [[ $VarChoice == "1" ]]
    then nl -bt Test.txt

elif [[ $VarChoice == "2" ]]
    then cat -n Test.txt

elif [[ $VarChoice == "3" ]]
    then  sed 's/$/$/' Test.txt

elif [[ $VarChoice == "4" ]]
    then cat -n .bashrc && sed 's/$/$/' Test.txt
    fi

echo 'press any button to end the script'
read

当我在终端中运行每个后缀命令时,我得到了正在应用的后缀的输出屏幕,但是当我在bash脚本中使用该命令时,却没有得到输出。

这是正常现象还是我做错了什么?

预先感谢您的帮助。

0 个答案:

没有答案