[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pushd/popd/dirs for es
Here is a pwd prettifier (that substitutes ~ for $home in the pathname)
that could conceivably call no external programs. It could be generalized
to take a list of arguments or at least one abitrary argument. For now it
just uses `pwd (which, if you use my pushd/popd frobs, is not an external
program).
fn pwd-pretty \
{
let (pwd = `pwd; pwdl = ; homel =)
{
~ $pwd $home && { echo '~'; return 0 }
~ $pwd $home^* || { echo $pwd; return 0 }
pwdl = <={ %split '/' $pwd }
homel = <={ %split '/' '.' $home }
pwdl = $pwdl($#homel ...)
echo <={ %flatten '/' '~' $pwdl }
}
}