![](/img/trans.png)
[英]Can you prompt for user input in a shell script that is running remotely?
[英]shell prompt not showing up after running a script
按照http://linuxcommand.org/lc3_wss0150.php,我正在嘗試運行此腳本
#!/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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.