~yerinalexey/dotfiles

15529021befac57748195a4996a8855268a7779f — Alexey Yerin 3 months ago 625f0a5
scripts/prompt: make it work with gawk
1 files changed, 3 insertions(+), 4 deletions(-)

M scripts/prompt
M scripts/prompt => scripts/prompt +3 -4
@@ 3,16 3,15 @@
pwd | sed "s@^$HOME@~@" | awk -F'/' '{
	last=NF - 3
	if (last <= 0) {
		printf "/%s" $0
		printf "/%s", $0
	} else {
		i=1
		while (i <= last) {
			split($i, a, "")
			printf "%s" a[1]
			printf "%s", substr($i, 1, 1)
			i++
		}
		while (i <= NF) {
			printf "/%s" $i
			printf "/%s", $i
			i++
		}
	}