Last active
November 8, 2022 08:17
-
-
Save loopmode/160059d5608f172d14519c2be5254148 to your computer and use it in GitHub Desktop.
abs_path for bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# realpath is not available on mac os | |
# this might be a useful alternative | |
abs_path () { | |
echo "$(cd $(dirname "$1");pwd)/$(basename "$1")" | |
} | |
echo $(abs_path .) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment