random-stuff/tildepath.sh
jan6 b4d495aaac Update 'tildepath.sh'
feel free to remove the busybox part, it's not necessary
2019-04-19 07:03:04 -04:00

11 lines
286 B
Bash

#!/bin/sh
dir=${1:-"$PWD"} busybox sh -c '
if test "$dir";then
if test "$dir" = "--help";then
echo "replaces /home/ with ~ making friendlier paths.";
else
true
fi;
fi
dir="${dir:-"$PWD"}";ls -d1p "$dir"|sed -E -e "s\`^[^/]\`$PWD/&\`" -e "s.^/home/$USER.~." -e "s.^/home(/|).~."
'