random-stuff/tildepath.sh

11 lines
286 B
Bash
Raw Normal View History

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