bash - normalize path
Bash[Edit]
+
0
-
0
Bash - normalize path
1 2 3 4 5 6 7 8 9 10 11#!/bin/bash input_path="/path/to/directory/../file" output_path="$(cd "$input_path" 2> /dev/null && pwd || echo -n)" echo "$output_path" # Output: # # /path/to/file
[Edit]
+
0
-
0
Bash - normalize path
1 2 3 4 5 6 7 8 9 10 11#!/bin/bash input_path="/path/to/directory/../file" output_path="$(realpath "$input_path")" echo "$output_path" # Output: # # /path/to/file
[Edit]
+
0
-
0
Bash - normalize path
1output_path="$(cd "$input_path" 2> /dev/null && pwd || echo -n)"
[Edit]
+
0
-
0
Bash - normalize path
1output_path="$(realpath "$input_path")"