I found that particularly with Centos 5, that the default shell prompt for root was terrible. It did not show the pwd, user or host!
Before -bash-3.1# ls Showing no present working directory, no current username, no hostname
Syntax PS1='\u@\h:\w\$ ' There are a few other things one can show also. Such as the time, date, FQHN etc. man bash for the full list.
After root@volcano:/tmp# ls
I recently dist-upgraded a ubuntu server, and one bash script stopped working.
#!/bin/bash
watch ' function yesno(){ case “$1” in
0) echo "yes" ;; 1) echo "no" ;; *) echo "error" ;;
esac }
sh: Syntax error: “(” unexpected
Remove the word function, and call it directly.
#!/bin/bash
watch ' yesno(){ case “$1” in
0) echo "yes" ;; 1) echo "no" ;; *) echo "error" ;;
esac }
Ref: http://stackoverflow.com/questions/6347119/bash-syntax-error