Update 'tildepath.sh'

This commit is contained in:
jan6 2019-04-19 07:01:06 -04:00
parent be8dbd51e8
commit ead0f51840
1 changed files with 6 additions and 5 deletions

View File

@ -1,11 +1,12 @@
#!/bin/sh
if test "$1";then
if test "$1" = "--help";then
dir=${1:-"$PWD"} busybox sh -c '
if test "$dir";then
if test "$dir" = "--help";then
echo "replaces /home/ with ~ making friendlier paths.";
echo "files relative to current directory";
else
lsopt="-d1f";ls="$1";
true
fi;
else lsopt="-f1";ls="./";
fi
ls $lsopt "$ls"|rev|cut -f1 -d" "|rev|sed -e "s\\^\\$PWD/\\" -e 's./home/.~.'
dir="${dir:-"$PWD"}";ls -d1p "$dir"|sed -E -e "s\`^[^/]\`$PWD/&\`" -e "s.^/home/$USER.~." -e "s.^/home(/|).~."
'