I'm trying to customize my fish prompt but i can't seem to put an if statement in it.
What I want : user@host ~/.config [127]>
What i tried :
function fish_prompt
echo -n $USER
echo -n "@"
echo -n $hostname
echo -n " "
echo -n (prompt_pwd)
echo -n (__fish_git_prompt)
if [ $status -ne 0 ]
echo -n " [$status] "
end
echo -n "> "
end
I want the $status to show only when there is an error.
So far, everything works except the if statement. (i tried the same if directly in the console and it worked, the problem occurs only in the fish_prompt) .
Thanks