Note the two spaces after the emoji moon; it leaves a decent space between prompt and your command.
This is the simplest possible prompt; just a moon phase. You will probably want to incorporate this into something fancier. My .bash_prompt file has its own line for the current path, Git smarts, and more.
Hi, This one should work for you - it's changed a little - now printing the name of the phase rather than the icon, used a bit of bc to do the math and also running it as a ksh script (not sure if that is important!)
!/bin/ksh
Convert a date to Julian.
function convert_to_julian {
let year=$1
let month=$2
let day=$3
let a=$year/100
let b=$a/4
let c=2-$a+$b
let e=365.25_($year+4716)
let e=$(echo "$e/1" |bc)
let f=30.6001_($month+1)
let f=$(echo "$f/1" |bc)
let converted_date=$c+$day+$e+$f-1524.5
}
Define the phases of the moon.
function get_moon_phase {
let year=$1
let month=$2
let day=$3
convert_to_julian $year $month $day
today=$converted_date
convert_to_julian 2000 1 6
converter=$converted_date
echo today is $today
echo converter is $converter
let phase_number=$today-$converter
let phase_number=$(echo "$phase_number%29.530588853" |bc)
phase_number=$(($(($today - $converter))/29))
echo the phase number is $phase_number
if [ $phase_number -lt "1.84566" ]; then phase_icon="new"
elif [ $phase_number -lt "5.53699" ]; then phase_icon="waxing crescent"
elif [ $phase_number -lt "9.22831" ]; then phase_icon="first quarter"
elif [ $phase_number -lt "12.91963" ]; then phase_icon="waxing gibbous"
elif [ $phase_number -lt "16.61096" ]; then phase_icon="full"
elif [ $phase_number -lt "20.30228" ]; then phase_icon="waning gibbous"
elif [ $phase_number -lt "23.99361" ]; then phase_icon="last quarter"
elif [ $phase_number -lt "27.68493" ]; then phase_icon="waning crescent"
else phase_icon="new"
fi
}
now the main line
let year=$1
let month=$2
let day=$3
get_moon_phase $year $month $day
echo $phase_icon