How to retrieve absolute path given relative
absolute, bash, path, shell
Solution
use:
find "$(pwd)"/ -type f
to get all files or
echo "$(pwd)/$line"
to display full path (if relative path matters to)
Problem
Is there a command to retrieve the absolute path given a relative path? For example I want $line to contain the absolute path of each file in dir `./etc/` ``` find ./ -type f | while read line; do echo $line done ```
Related problems
- Is there a way to get the git root directory in one command?
- How to obtain the absolute path of a file via Shell (BASH/ZSH/SH)?
- Converting relative path into absolute path?
- How do I get the directory where a Bash script is located from within the script itself?
- How to convert relative path to absolute path in Unix
- Convert absolute path into relative path given a current directory using Bash
- /bin/sh: pushd: not found
- How do you normalize a file path in Bash?