random-stuff/tildepath.sh

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(/|).~."
'