2
0
mirror of https://github.com/spritsail/alpine.git synced 2024-12-20 11:34:36 +00:00

Replace ppwd with inline sed expression

This commit is contained in:
Joe Groocock 2018-07-03 20:43:30 +01:00
parent 90548d3f0f
commit 78fa7c8b2d
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
3 changed files with 2 additions and 21 deletions

View File

@ -23,7 +23,7 @@ RUN apk --no-cache add \
tini \ tini \
openssl \ openssl \
&& wget -qO /sbin/su-exec https://github.com/frebib/su-exec/releases/download/${SU_EXEC_VER}/su-exec-alpine-$(uname -m) \ && wget -qO /sbin/su-exec https://github.com/frebib/su-exec/releases/download/${SU_EXEC_VER}/su-exec-alpine-$(uname -m) \
&& chmod +x /sbin/su-exec /usr/bin/* \ && chmod +x /sbin/su-exec \
&& apk --no-cache del openssl && apk --no-cache del openssl
ENTRYPOINT ["/sbin/tini" , "--"] ENTRYPOINT ["/sbin/tini" , "--"]

View File

@ -1,6 +1,6 @@
export PAGER='/usr/bin/less -R' export PAGER='/usr/bin/less -R'
export EDITOR='/usr/bin/vi' export EDITOR='/usr/bin/vi'
export PS1='\e[1;36m\u@\h\e[0m \e[0;32m$(ppwd)\e[0m> ' export PS1='\e[1;36m\u@\h\e[0m \e[0;32m$(pwd | sed -E '"'s|^'\$HOME'|~|;s|(.*)/|\\1%#|;s|((^\\|/)\\.?[^/%]{1})[^/%]*|\\1|g;s|(.*)%#|\\1/|')"'\e[0m> '
# Source configuration files from /etc/profile.d # Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do for i in /etc/profile.d/*.sh ; do

View File

@ -1,19 +0,0 @@
#!/bin/sh
set -e -o pipefail
dir="$(echo -n "${1:-$PWD}" | sed "s|$HOME|~|")"
if [ "$dir" = '~' -o "$dir" = '/' ]; then
echo "$dir"
exit 0
fi
parts="$(echo "$dir" | tr '/' '\n' | sed '$d')"
last="$(echo "$dir" | tr '/' '\n' | tail -n 1)"
for d in "$parts"; do
out="$out$(echo "$d" | sed -E '/^\./s/^(.{2}).*/\1/;/^[^\.]/s/^(.{1}).*/\1/')\n"
done
echo -en "$out" | tr '\n' '/'
echo "$last"