Check if two paths are the same, even if their strings don't match exactly
I have a script that depends on some environment variables, some of which are paths
The script checks if it's being run in the correct directory by checking $(pwd)/expected-subdir against $VARIABLE_PATH/expected_subdir
Of course if $VARIABLE_PATH == $(pwd)/ (I naturally appended a slash to the end of the variable when typing it), the string match fails even though the directories are technically sane.
Is there a way to uniquely identify a directory, given a path to it, and see if another path will route you to the same spot? It's possible the path given is not sane, so this check should still be done, but it seems unnecessary to force the path to exactly match, when a stray slash or even a relative directory (I know these can be bad sometimes) would route you to the same spot.
linux bash directory-listing
add a comment |
I have a script that depends on some environment variables, some of which are paths
The script checks if it's being run in the correct directory by checking $(pwd)/expected-subdir against $VARIABLE_PATH/expected_subdir
Of course if $VARIABLE_PATH == $(pwd)/ (I naturally appended a slash to the end of the variable when typing it), the string match fails even though the directories are technically sane.
Is there a way to uniquely identify a directory, given a path to it, and see if another path will route you to the same spot? It's possible the path given is not sane, so this check should still be done, but it seems unnecessary to force the path to exactly match, when a stray slash or even a relative directory (I know these can be bad sometimes) would route you to the same spot.
linux bash directory-listing
add a comment |
I have a script that depends on some environment variables, some of which are paths
The script checks if it's being run in the correct directory by checking $(pwd)/expected-subdir against $VARIABLE_PATH/expected_subdir
Of course if $VARIABLE_PATH == $(pwd)/ (I naturally appended a slash to the end of the variable when typing it), the string match fails even though the directories are technically sane.
Is there a way to uniquely identify a directory, given a path to it, and see if another path will route you to the same spot? It's possible the path given is not sane, so this check should still be done, but it seems unnecessary to force the path to exactly match, when a stray slash or even a relative directory (I know these can be bad sometimes) would route you to the same spot.
linux bash directory-listing
I have a script that depends on some environment variables, some of which are paths
The script checks if it's being run in the correct directory by checking $(pwd)/expected-subdir against $VARIABLE_PATH/expected_subdir
Of course if $VARIABLE_PATH == $(pwd)/ (I naturally appended a slash to the end of the variable when typing it), the string match fails even though the directories are technically sane.
Is there a way to uniquely identify a directory, given a path to it, and see if another path will route you to the same spot? It's possible the path given is not sane, so this check should still be done, but it seems unnecessary to force the path to exactly match, when a stray slash or even a relative directory (I know these can be bad sometimes) would route you to the same spot.
linux bash directory-listing
linux bash directory-listing
asked Jan 21 at 14:46
Brydon GibsonBrydon Gibson
377213
377213
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
This other answer mentions stat. Let's improve the approach:
a="$(stat --format=%d:%i -- "$(pwd)/expected-subdir/")" || printf "Error An" >&2
b="$(stat --format=%d:%i -- "$VARIABLE_PATH/expected-subdir/")" || printf "Error Bn" >&2
[ "$a" = "$b" ] || printf "Not the same path.n" >&2
Notes:
- We're using
stat --format=, so no further parsing is required.
%dis device number,%iis inode number. The latter alone is not enough because two objects on different devices (filesystems) may have the same inode number.- The shell is smart enough to separately handle quotes inside and outside
$( ).
printf-s are just stubs for error handling. In the real script you'd probably want something like
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
Nonexistent path will make
statthrow an error.- Trailing slashes are important. If
foois a symlink to a directory,stat foowill examine the symlink whilestat foo/will examine the directory. Alternatively researchstat -Land use it maybe.
--is in case$(pwd)or$VARIABLE_PATHbegins with-(see guideline 10 here).
There are readlink -f (also mentioned in the other answer) and realpath utilities. One of them may be a better approach than stat. It depends on which aspects of paths are important to you. Main differences:
- If
/foo/bar/is a bind mount to/moo/baz/thenstat --format=%d:%iwill tell you they are the same, butreadlinkorrealpathwill consider them different. - The situation gets complicated with symlinks and
... Seeman 1 realpath, especially-Land-Poptions.
With symlinks involved, if your script changes the directory upwards (towards /, e.g. cd ..), you may get different results depending on where you start, even if stat or readlink -f says the two starting points are the same (compare Why does ls .. show real parent content when I'm inside a symbolic link directory?). Consider this approach:
# early in the script
set -P
cd . # seems like no-op but updates the PWD variable to physical path
With bind mounts involved, if your script changes the directory, you may get different results depending on where you start, even if stat says the two starting points are the same. Consider the example with /foo/bar/ and /moo/baz/ (already introduced above). It's obvious /foo/ may be completely different than /moo/. But also /foo/bar/abc may be different than /moo/baz/abc because any abc may be an independent bind mount to something else. So not only cd .. may place you in a different spot, but also cd abc.
Well, abc may be a file. What if you bind another file to /moo/baz/abc but not to /foo/bar/abc? The perceived files will be different even if stat says you're in the same place!
Because of these problems you may indeed prefer readlink or realpath over stat.
stat, readlink and realpath are not required by POSIX. In your case a portable solution may look like this:
a="$(cd -P -- "expected-subdir" && pwd -P)" || exit 1
b="$(cd -P -- "$VARIABLE_PATH/expected-subdir" && pwd -P)" || exit 1
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
It works by cd-ing to either path and retrieving it with pwd. These operations are explicitly forced to act "physically" (-P).
set -P is not POSIX either. If you want POSIX shell to "emulate" set -P, replace cd and pwd:
cd() { command cd -P "$@"; }
pwd() { command pwd -P "$@"; }
POSIX requires the last -P or -L option to take effect, so pwd -L still retrieves the logical path even though the function "injects" -P; the same for cd -L.
add a comment |
You can compare their inode numbers, which can be obtained from ls -i
ls -di path/to/dir
(-d prevents ls from showing the inode ids for the contents of the directory);
or from stat
stat path/to/dir | grep -o 'Inode: [0-9]*' | cut -d' ' -f2
You can also use readlink -f to get the full path to the directory.
For scripting, it might be easier to usefind path/to/dir/ -maxdepth 0 -printf %i\nas that prints just the inode, and not the name. Themaxdepth 0prevents a deep search. For extra safety, add%Dsince inodes are only unique per disk, not systemwide.
– MSalters
Jan 21 at 16:17
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396645%2fcheck-if-two-paths-are-the-same-even-if-their-strings-dont-match-exactly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This other answer mentions stat. Let's improve the approach:
a="$(stat --format=%d:%i -- "$(pwd)/expected-subdir/")" || printf "Error An" >&2
b="$(stat --format=%d:%i -- "$VARIABLE_PATH/expected-subdir/")" || printf "Error Bn" >&2
[ "$a" = "$b" ] || printf "Not the same path.n" >&2
Notes:
- We're using
stat --format=, so no further parsing is required.
%dis device number,%iis inode number. The latter alone is not enough because two objects on different devices (filesystems) may have the same inode number.- The shell is smart enough to separately handle quotes inside and outside
$( ).
printf-s are just stubs for error handling. In the real script you'd probably want something like
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
Nonexistent path will make
statthrow an error.- Trailing slashes are important. If
foois a symlink to a directory,stat foowill examine the symlink whilestat foo/will examine the directory. Alternatively researchstat -Land use it maybe.
--is in case$(pwd)or$VARIABLE_PATHbegins with-(see guideline 10 here).
There are readlink -f (also mentioned in the other answer) and realpath utilities. One of them may be a better approach than stat. It depends on which aspects of paths are important to you. Main differences:
- If
/foo/bar/is a bind mount to/moo/baz/thenstat --format=%d:%iwill tell you they are the same, butreadlinkorrealpathwill consider them different. - The situation gets complicated with symlinks and
... Seeman 1 realpath, especially-Land-Poptions.
With symlinks involved, if your script changes the directory upwards (towards /, e.g. cd ..), you may get different results depending on where you start, even if stat or readlink -f says the two starting points are the same (compare Why does ls .. show real parent content when I'm inside a symbolic link directory?). Consider this approach:
# early in the script
set -P
cd . # seems like no-op but updates the PWD variable to physical path
With bind mounts involved, if your script changes the directory, you may get different results depending on where you start, even if stat says the two starting points are the same. Consider the example with /foo/bar/ and /moo/baz/ (already introduced above). It's obvious /foo/ may be completely different than /moo/. But also /foo/bar/abc may be different than /moo/baz/abc because any abc may be an independent bind mount to something else. So not only cd .. may place you in a different spot, but also cd abc.
Well, abc may be a file. What if you bind another file to /moo/baz/abc but not to /foo/bar/abc? The perceived files will be different even if stat says you're in the same place!
Because of these problems you may indeed prefer readlink or realpath over stat.
stat, readlink and realpath are not required by POSIX. In your case a portable solution may look like this:
a="$(cd -P -- "expected-subdir" && pwd -P)" || exit 1
b="$(cd -P -- "$VARIABLE_PATH/expected-subdir" && pwd -P)" || exit 1
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
It works by cd-ing to either path and retrieving it with pwd. These operations are explicitly forced to act "physically" (-P).
set -P is not POSIX either. If you want POSIX shell to "emulate" set -P, replace cd and pwd:
cd() { command cd -P "$@"; }
pwd() { command pwd -P "$@"; }
POSIX requires the last -P or -L option to take effect, so pwd -L still retrieves the logical path even though the function "injects" -P; the same for cd -L.
add a comment |
This other answer mentions stat. Let's improve the approach:
a="$(stat --format=%d:%i -- "$(pwd)/expected-subdir/")" || printf "Error An" >&2
b="$(stat --format=%d:%i -- "$VARIABLE_PATH/expected-subdir/")" || printf "Error Bn" >&2
[ "$a" = "$b" ] || printf "Not the same path.n" >&2
Notes:
- We're using
stat --format=, so no further parsing is required.
%dis device number,%iis inode number. The latter alone is not enough because two objects on different devices (filesystems) may have the same inode number.- The shell is smart enough to separately handle quotes inside and outside
$( ).
printf-s are just stubs for error handling. In the real script you'd probably want something like
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
Nonexistent path will make
statthrow an error.- Trailing slashes are important. If
foois a symlink to a directory,stat foowill examine the symlink whilestat foo/will examine the directory. Alternatively researchstat -Land use it maybe.
--is in case$(pwd)or$VARIABLE_PATHbegins with-(see guideline 10 here).
There are readlink -f (also mentioned in the other answer) and realpath utilities. One of them may be a better approach than stat. It depends on which aspects of paths are important to you. Main differences:
- If
/foo/bar/is a bind mount to/moo/baz/thenstat --format=%d:%iwill tell you they are the same, butreadlinkorrealpathwill consider them different. - The situation gets complicated with symlinks and
... Seeman 1 realpath, especially-Land-Poptions.
With symlinks involved, if your script changes the directory upwards (towards /, e.g. cd ..), you may get different results depending on where you start, even if stat or readlink -f says the two starting points are the same (compare Why does ls .. show real parent content when I'm inside a symbolic link directory?). Consider this approach:
# early in the script
set -P
cd . # seems like no-op but updates the PWD variable to physical path
With bind mounts involved, if your script changes the directory, you may get different results depending on where you start, even if stat says the two starting points are the same. Consider the example with /foo/bar/ and /moo/baz/ (already introduced above). It's obvious /foo/ may be completely different than /moo/. But also /foo/bar/abc may be different than /moo/baz/abc because any abc may be an independent bind mount to something else. So not only cd .. may place you in a different spot, but also cd abc.
Well, abc may be a file. What if you bind another file to /moo/baz/abc but not to /foo/bar/abc? The perceived files will be different even if stat says you're in the same place!
Because of these problems you may indeed prefer readlink or realpath over stat.
stat, readlink and realpath are not required by POSIX. In your case a portable solution may look like this:
a="$(cd -P -- "expected-subdir" && pwd -P)" || exit 1
b="$(cd -P -- "$VARIABLE_PATH/expected-subdir" && pwd -P)" || exit 1
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
It works by cd-ing to either path and retrieving it with pwd. These operations are explicitly forced to act "physically" (-P).
set -P is not POSIX either. If you want POSIX shell to "emulate" set -P, replace cd and pwd:
cd() { command cd -P "$@"; }
pwd() { command pwd -P "$@"; }
POSIX requires the last -P or -L option to take effect, so pwd -L still retrieves the logical path even though the function "injects" -P; the same for cd -L.
add a comment |
This other answer mentions stat. Let's improve the approach:
a="$(stat --format=%d:%i -- "$(pwd)/expected-subdir/")" || printf "Error An" >&2
b="$(stat --format=%d:%i -- "$VARIABLE_PATH/expected-subdir/")" || printf "Error Bn" >&2
[ "$a" = "$b" ] || printf "Not the same path.n" >&2
Notes:
- We're using
stat --format=, so no further parsing is required.
%dis device number,%iis inode number. The latter alone is not enough because two objects on different devices (filesystems) may have the same inode number.- The shell is smart enough to separately handle quotes inside and outside
$( ).
printf-s are just stubs for error handling. In the real script you'd probably want something like
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
Nonexistent path will make
statthrow an error.- Trailing slashes are important. If
foois a symlink to a directory,stat foowill examine the symlink whilestat foo/will examine the directory. Alternatively researchstat -Land use it maybe.
--is in case$(pwd)or$VARIABLE_PATHbegins with-(see guideline 10 here).
There are readlink -f (also mentioned in the other answer) and realpath utilities. One of them may be a better approach than stat. It depends on which aspects of paths are important to you. Main differences:
- If
/foo/bar/is a bind mount to/moo/baz/thenstat --format=%d:%iwill tell you they are the same, butreadlinkorrealpathwill consider them different. - The situation gets complicated with symlinks and
... Seeman 1 realpath, especially-Land-Poptions.
With symlinks involved, if your script changes the directory upwards (towards /, e.g. cd ..), you may get different results depending on where you start, even if stat or readlink -f says the two starting points are the same (compare Why does ls .. show real parent content when I'm inside a symbolic link directory?). Consider this approach:
# early in the script
set -P
cd . # seems like no-op but updates the PWD variable to physical path
With bind mounts involved, if your script changes the directory, you may get different results depending on where you start, even if stat says the two starting points are the same. Consider the example with /foo/bar/ and /moo/baz/ (already introduced above). It's obvious /foo/ may be completely different than /moo/. But also /foo/bar/abc may be different than /moo/baz/abc because any abc may be an independent bind mount to something else. So not only cd .. may place you in a different spot, but also cd abc.
Well, abc may be a file. What if you bind another file to /moo/baz/abc but not to /foo/bar/abc? The perceived files will be different even if stat says you're in the same place!
Because of these problems you may indeed prefer readlink or realpath over stat.
stat, readlink and realpath are not required by POSIX. In your case a portable solution may look like this:
a="$(cd -P -- "expected-subdir" && pwd -P)" || exit 1
b="$(cd -P -- "$VARIABLE_PATH/expected-subdir" && pwd -P)" || exit 1
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
It works by cd-ing to either path and retrieving it with pwd. These operations are explicitly forced to act "physically" (-P).
set -P is not POSIX either. If you want POSIX shell to "emulate" set -P, replace cd and pwd:
cd() { command cd -P "$@"; }
pwd() { command pwd -P "$@"; }
POSIX requires the last -P or -L option to take effect, so pwd -L still retrieves the logical path even though the function "injects" -P; the same for cd -L.
This other answer mentions stat. Let's improve the approach:
a="$(stat --format=%d:%i -- "$(pwd)/expected-subdir/")" || printf "Error An" >&2
b="$(stat --format=%d:%i -- "$VARIABLE_PATH/expected-subdir/")" || printf "Error Bn" >&2
[ "$a" = "$b" ] || printf "Not the same path.n" >&2
Notes:
- We're using
stat --format=, so no further parsing is required.
%dis device number,%iis inode number. The latter alone is not enough because two objects on different devices (filesystems) may have the same inode number.- The shell is smart enough to separately handle quotes inside and outside
$( ).
printf-s are just stubs for error handling. In the real script you'd probably want something like
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
Nonexistent path will make
statthrow an error.- Trailing slashes are important. If
foois a symlink to a directory,stat foowill examine the symlink whilestat foo/will examine the directory. Alternatively researchstat -Land use it maybe.
--is in case$(pwd)or$VARIABLE_PATHbegins with-(see guideline 10 here).
There are readlink -f (also mentioned in the other answer) and realpath utilities. One of them may be a better approach than stat. It depends on which aspects of paths are important to you. Main differences:
- If
/foo/bar/is a bind mount to/moo/baz/thenstat --format=%d:%iwill tell you they are the same, butreadlinkorrealpathwill consider them different. - The situation gets complicated with symlinks and
... Seeman 1 realpath, especially-Land-Poptions.
With symlinks involved, if your script changes the directory upwards (towards /, e.g. cd ..), you may get different results depending on where you start, even if stat or readlink -f says the two starting points are the same (compare Why does ls .. show real parent content when I'm inside a symbolic link directory?). Consider this approach:
# early in the script
set -P
cd . # seems like no-op but updates the PWD variable to physical path
With bind mounts involved, if your script changes the directory, you may get different results depending on where you start, even if stat says the two starting points are the same. Consider the example with /foo/bar/ and /moo/baz/ (already introduced above). It's obvious /foo/ may be completely different than /moo/. But also /foo/bar/abc may be different than /moo/baz/abc because any abc may be an independent bind mount to something else. So not only cd .. may place you in a different spot, but also cd abc.
Well, abc may be a file. What if you bind another file to /moo/baz/abc but not to /foo/bar/abc? The perceived files will be different even if stat says you're in the same place!
Because of these problems you may indeed prefer readlink or realpath over stat.
stat, readlink and realpath are not required by POSIX. In your case a portable solution may look like this:
a="$(cd -P -- "expected-subdir" && pwd -P)" || exit 1
b="$(cd -P -- "$VARIABLE_PATH/expected-subdir" && pwd -P)" || exit 1
[ "$a" = "$b" ] || { printf "Not the same path.n" >&2; exit 2; }
It works by cd-ing to either path and retrieving it with pwd. These operations are explicitly forced to act "physically" (-P).
set -P is not POSIX either. If you want POSIX shell to "emulate" set -P, replace cd and pwd:
cd() { command cd -P "$@"; }
pwd() { command pwd -P "$@"; }
POSIX requires the last -P or -L option to take effect, so pwd -L still retrieves the logical path even though the function "injects" -P; the same for cd -L.
edited Jan 22 at 9:45
answered Jan 22 at 8:46
Kamil MaciorowskiKamil Maciorowski
28.3k156185
28.3k156185
add a comment |
add a comment |
You can compare their inode numbers, which can be obtained from ls -i
ls -di path/to/dir
(-d prevents ls from showing the inode ids for the contents of the directory);
or from stat
stat path/to/dir | grep -o 'Inode: [0-9]*' | cut -d' ' -f2
You can also use readlink -f to get the full path to the directory.
For scripting, it might be easier to usefind path/to/dir/ -maxdepth 0 -printf %i\nas that prints just the inode, and not the name. Themaxdepth 0prevents a deep search. For extra safety, add%Dsince inodes are only unique per disk, not systemwide.
– MSalters
Jan 21 at 16:17
add a comment |
You can compare their inode numbers, which can be obtained from ls -i
ls -di path/to/dir
(-d prevents ls from showing the inode ids for the contents of the directory);
or from stat
stat path/to/dir | grep -o 'Inode: [0-9]*' | cut -d' ' -f2
You can also use readlink -f to get the full path to the directory.
For scripting, it might be easier to usefind path/to/dir/ -maxdepth 0 -printf %i\nas that prints just the inode, and not the name. Themaxdepth 0prevents a deep search. For extra safety, add%Dsince inodes are only unique per disk, not systemwide.
– MSalters
Jan 21 at 16:17
add a comment |
You can compare their inode numbers, which can be obtained from ls -i
ls -di path/to/dir
(-d prevents ls from showing the inode ids for the contents of the directory);
or from stat
stat path/to/dir | grep -o 'Inode: [0-9]*' | cut -d' ' -f2
You can also use readlink -f to get the full path to the directory.
You can compare their inode numbers, which can be obtained from ls -i
ls -di path/to/dir
(-d prevents ls from showing the inode ids for the contents of the directory);
or from stat
stat path/to/dir | grep -o 'Inode: [0-9]*' | cut -d' ' -f2
You can also use readlink -f to get the full path to the directory.
answered Jan 21 at 14:54
chorobachoroba
13.4k13341
13.4k13341
For scripting, it might be easier to usefind path/to/dir/ -maxdepth 0 -printf %i\nas that prints just the inode, and not the name. Themaxdepth 0prevents a deep search. For extra safety, add%Dsince inodes are only unique per disk, not systemwide.
– MSalters
Jan 21 at 16:17
add a comment |
For scripting, it might be easier to usefind path/to/dir/ -maxdepth 0 -printf %i\nas that prints just the inode, and not the name. Themaxdepth 0prevents a deep search. For extra safety, add%Dsince inodes are only unique per disk, not systemwide.
– MSalters
Jan 21 at 16:17
For scripting, it might be easier to use
find path/to/dir/ -maxdepth 0 -printf %i\n as that prints just the inode, and not the name. The maxdepth 0 prevents a deep search. For extra safety, add %D since inodes are only unique per disk, not systemwide.– MSalters
Jan 21 at 16:17
For scripting, it might be easier to use
find path/to/dir/ -maxdepth 0 -printf %i\n as that prints just the inode, and not the name. The maxdepth 0 prevents a deep search. For extra safety, add %D since inodes are only unique per disk, not systemwide.– MSalters
Jan 21 at 16:17
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396645%2fcheck-if-two-paths-are-the-same-even-if-their-strings-dont-match-exactly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown