Showing posts with label コマンドプロンプト. Show all posts
Showing posts with label コマンドプロンプト. Show all posts

Monday, October 17, 2016

Bash (Unix shell): Changing Command Prompt

Command:

$ PS1="( ^ω^ ) "


Result:

( ^ω^ )


Command:

( ^ω^ ) PS1="$ "


Result:

$

Bash (Unix shell): Select Menu Example: PS3

Command:

$ PS3="please select item > "; select item in "item1" "item2" "item3"; do if [ $REPLY = "q" ]; then break; fi; done;


Result:

1) item1
2) item2
3) item3
please select item >


User input:

1


Result:

please select item >


User input:

q

Bash (Unix shell): Command prompt (コマンドプロンプト)

Command:

$ read -p "Do something? "; if [ $REPLY == "y" ]; then echo yay; fi


Result:

Do something?


User input:

y


Result:

yay