Created
January 31, 2023 23:13
-
-
Save scottnunemacher/0ff0b5126126743f5fc074952e9b8815 to your computer and use it in GitHub Desktop.
Getting the parent of a directory from bash variable
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
#!/usr/bin/env bash | |
# From: https://stackoverflow.com/a/42956288 | |
# example: dir=/home/smith/Desktop/Test | |
parentdir=$(builtin cd $dir; pwd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment