Skip to content

Instantly share code, notes, and snippets.

@mgild
Created February 26, 2026 17:55
Show Gist options
  • Select an option

  • Save mgild/85a7f4997ea6d3d1db1440f9d9ac1a60 to your computer and use it in GitHub Desktop.

Select an option

Save mgild/85a7f4997ea6d3d1db1440f9d9ac1a60 to your computer and use it in GitHub Desktop.
up () {
declare -i d=${@:-1}
(($d < 0)) && (
echo "up: Error: negative value provided" >&2
) && return 1
builtin cd "$(pwd | sed -E 's;(/[^/]*){0,'$d'}$;;')/"
ls -G
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment