简体   繁体   中英

PS1 Command - Bash

I am trying to get the PS1 command working with bash.

What I am trying to do is capture the user's data and input it to change the field on the command line.

I know the command is PS1="MadMike" , but what I am trying to do is the captured data from the read line and insert it into the command and then run the command

#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:"

You've missed the $ sign to get the content of the input variable. It should be:

PS1="$input:"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM