ฉันเป็นคนหนึ่งที่ชอบใช้เครื่องปลายทาง ฉันคิดว่าผู้ใช้ทั้งหมดของ GNU / Linux เมื่อถึงจุดหนึ่งพวกเขาขาดไม่ได้เพราะหน้าต่างที่เต็มไปด้วยตัวอักษรทำให้ชีวิตง่ายขึ้นมากสำหรับเราใช่ไหม?
แต่เราสามารถทำให้มันดูสวยกว่าค่าเริ่มต้นเล็กน้อย ตัวอย่างนี้สามารถดูได้ (และดาวน์โหลด) จาก คำพังเพย - ดู. เคล็ดลับที่ฉันจะแสดงให้คุณเห็นด้านล่างคือการออกจากอาคารผู้โดยสารของเราโดยมีลักษณะดังต่อไปนี้:
อย่างที่คุณเห็นไฟล์ คำสั่งเพื่อดำเนินการ และวางไว้ระหว่างแต่ละคำสั่ง ไทม์ไลน์ ด้วยเวลาของระบบ
ฉันต้องทำอย่างไร?
เราเปิดโปรแกรมแก้ไขข้อความ (ตัวอย่าง Gedit) และเราใส่ไว้ข้างใน:
# Fill with minuses
# (this is recalculated every time the prompt is shown in function prompt_command):
fill="--- "
reset_style='\[\033[00m\]'
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
prompt_style=$reset_style
command_style=$reset_style'\[\033[1;29m\]' # bold black
# Prompt variable:
PS1="$status_style"'$fill \t\n'"$prompt_style"'${debian_chroot:+($debian_chroot)}\u@\h:\w\$'"$command_style "
# Reset color for command output
# (this one is invoked every time before a command is executed):
trap 'echo -ne "\e[0m"' DEBUG
function prompt_command {
# create a $fill of all screen width minus the time string and a space:
let fillsize=${COLUMNS}-9
fill=""
while [ "$fillsize" -gt "0" ]
do
fill="-${fill}" # fill with underscores to work on
let fillsize=${fillsize}-1
done
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
bname=`basename "${PWD/$HOME/~}"`
echo -ne "\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"
;;
*)
;;
esac
}
PROMPT_COMMAND=prompt_command
เราเก็บไว้ในของเรา / หน้าแรก ด้วยชื่อ .bash_ps2 ตัวอย่างเช่น. จากนั้นเราเปิดไฟล์ .bashrc และเราเพิ่ม:
if [ -f "$HOME/.bash_ps2" ]; then
. "$HOME/.bash_ps2"
fi
เราเปิดเทอร์มินัลแล้วเราจะเห็นการเปลี่ยนแปลง
เห็นใน: มนุษย์.
