PS1-4

export PS2="continue->"

cat ps4.sh

export PS4='$0.$LINENO+ '

set -x

echo "PS4 demo script"

ls -l /etc/ | wc -l

du -sh ~

ramesh@dev-db ~> ./ps4.sh

../ps4.sh.3+ echo 'PS4 demo script'

PS4 demo script

../ps4.sh.4+ ls -l /etc/



In the PS1 environment variable, you can directly execute any Linux

command, by specifying in the format $(linux_command). In the following

example, the command $(date) is executed to display the current time inside

the prompt.

ramesh@dev-db ~> export PS1="u@h [$(date

+%k:%m:%S)]>

原文地址:https://www.cnblogs.com/openix/p/3519177.html