一个脚本sh02.sh是:
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
read -p "Please input your first name: " firstname
read -p "Please input your last name: " lastname
echo -e "\nYour full name is: $firstname $lastname
但执行时提示sh02.sh: -p: is not an identifier
我直接在unix中敲read -p "Please input your first name: " firstname没有问题,请问是脚本哪里不对?
另外,当仅执行echo -e "\nYour full name is: $firstname $lastname时显示一个:
-e
Your full name is:
这里-e怎么会打印出呢?
谢谢!
确实是“read is a shell builtin”这个回显,这是什么意思?
在命令行里敲了set /p,还是如此的。
追答那真不清楚了,我这边都一切正常。
修改为echo -e "\nYour full name is: $firstname $lastname",还是如此
追答也不知道,你怎么写的,我直接复制你上边写的,加个冒号就行了。
[flycat@redhat script]$ chmod 755 aaa.sh
[flycat@redhat script]$ ./aaa.sh
Please input your first name: 4
Please input your last name: 3
Your full name is: 4 3
是/usr/bin/ksh,文件头修改为/usr/bin/ksh后还是如此
追答这个就不知道了 Unix没玩过 shell也只用bash 不好意思