shell脚本的一个简单程序问题

问题遇到的现象和发生背景

[centos@localhost bin]$ show123-2.sh 3
This program will print your choice

Your choice is
3
[centos@localhost bin]$

问题相关代码,请勿粘贴截图
function printit(){
        echo -e "Your choice is  "
}
echo -e "This program will print your choice\n"
case $1 in
        "1")
                printit;echo -e "$1"
                ;;
        "2")
                printit;echo -e "$1"
                ;;
        "3")
                printit;echo -e "$1"
                ;;
        *)
                echo -e "You just have three choices that is 1 2 3."
                exit 1
                ;;
esac
exit 0
运行结果及报错内容

为什么Your choice is 3,is 和3之间有个回车呢?

我的解答思路和尝试过的方法
我想要达到的结果

能否去掉这个回车?


```bash


```

因为函数调用再加echo会换行的~~所以你的结果会换行


能否去掉这个回车?可以,很简单~~加一个 -n 参数就可以,脚本如下

#!/bin/bash
function printit(){
        echo -e -n "Your choice is "
}
echo -e "This program will print your choice\n"
case $1 in
        "1")
                printit;echo -e "$1"
                ;;
        "2")
                printit;echo -e "$1"
                ;;
        "3")
                printit;echo -e "$1"
                ;;
        *)
                echo -e "You just have three choices that is 1 2 3."
                exit 1
                ;;
esac
exit 0