Linux 运行脚本后未显示shell提示符

Linux 运行脚本后未显示shell提示符,linux,bash,shell,Linux,Bash,Shell,根据,我正在尝试运行此脚本 #!/bin/bash # Program to print a text file with headers and footers TEMP_FILE=./printfile.txt pr $1 > $TEMP_FILE echo -n "Print file? [y/n]: " read if [ "$REPLY" = "y" ]; then less $TEMP_FILE fi 但是当我通过 ./print_demo.bash 这就是

根据,我正在尝试运行此脚本

#!/bin/bash

# Program to print a text file with headers and footers

TEMP_FILE=./printfile.txt

pr $1 > $TEMP_FILE

echo -n "Print file? [y/n]: "
read
if [ "$REPLY" = "y" ]; then
    less $TEMP_FILE
fi
但是当我通过

./print_demo.bash

这就是它在我的bin目录中保存的内容,它不会回显“打印文件?[y/n]:”,也不会返回shell提示。我必须按ctrl^c键才能将其取回。

该脚本需要输入

pr "$1" > $TEMP_FILE 
$1表示命令行中的第一个参数

./print_demo.bash <printable_filename_here.txt>
/print\u demo.bash

您需要为脚本提供一个参数。如果没有,
pr
什么是标准输入。如果您正确地引用了
$1
,您还会收到一条错误消息
pr:cannot open,没有这样的文件或目录
。出于类似的原因,其他变量也需要被引用。