PS1 Command - Bash



我正在尝试让PS1命令与bash一起使用。

我正在尝试做的是捕获用户的数据并输入它以更改命令行上的字段。

我知道该命令PS1="MadMike",但是我要做的是从读取行中捕获的数据并将其插入命令中,然后运行命令

#PS1 Method
1)
echo -e "n"
#Sub Menu for Method
echo "============================================"
echo "What would you like your command line to say"
echo "============================================"
echo -e "n"
#Waiting for user input
echo "Type below"
#Capturing User input
read input
#Setting PS1 input
PS1="input:"

您错过了获取input变量内容的$符号。它应该是:

PS1="$input:"

最新更新