https://github.com/lucaslarson/samefile
⚖️ a portable, POSIX-compliant implementation of Bash’s `-ef` test, sharing a device and an inode value
https://github.com/lucaslarson/samefile
bash-ef bourne-shell hacktoberfest inode inodes oh-my-zsh-plugin ohmyzsh-plugin posix-compatible posix-compliance posix-shell same-file same-files samefile zsh-plugin zsh-plugins
Last synced: 3 months ago
JSON representation
⚖️ a portable, POSIX-compliant implementation of Bash’s `-ef` test, sharing a device and an inode value
- Host: GitHub
- URL: https://github.com/lucaslarson/samefile
- Owner: LucasLarson
- License: other
- Created: 2021-04-14T23:18:43.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-29T19:33:09.000Z (9 months ago)
- Last Synced: 2025-01-11T03:30:37.590Z (4 months ago)
- Topics: bash-ef, bourne-shell, hacktoberfest, inode, inodes, oh-my-zsh-plugin, ohmyzsh-plugin, posix-compatible, posix-compliance, posix-shell, same-file, same-files, samefile, zsh-plugin, zsh-plugins
- Language: Shell
- Homepage:
- Size: 52.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Funding: .github/funding.yml
- License: license.adoc
- Code of conduct: .github/code_of_conduct.md
- Codeowners: .github/codeowners
Awesome Lists containing this project
README
# samefile
⚖️ a portable, POSIX-compliant implementation of Bash’s `-ef` test
[](https://github.com/LucasLarson/samefile/blob/main/license.adoc)
[](https://github.com/LucasLarson/samefile/releases/latest)
[](https://github.com/LucasLarson/samefile/actions?query=workflow:"Super-Linter")## Installation
### L337
Make sure the [executable named
`samefile`](https://github.com/LucasLarson/samefile/blob/main/bin/samefile) in
`bin/` is either- moved into a directory in `$PATH`, or
- added to `$PATH`.### Oh My Zsh
1. clone the repostory:
```sh
git clone --depth 1 https://github.com/LucasLarson/samefile "${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}"/plugins/samefile
```2. Next, open the `.zshrc` file in your home directory
2. insert the word ` samefile ` between the parentheses on the line that begins
with `plugins=`.
2. save and close the file, then `source` it with `. "${HOME}"/.zshrc`.## Usage
```sh
# not this
[ path/to/some/file -ef path/to/another/file ]
# and definitely not this
[[ path/to/some/file -ef path/to/another/file ]]# but rather this
samefile path/to/some/file path/to/another/file
# or this
samefile --verbose path/to/some/file path/to/another/file
# or this
samefile -v path/to/some/file path/to/another/file# returns a `0` exit status on success and `1` for failure
# just like `[`, `[[`, and `test`
```Bash’s `-ef` and `samefile` both check that two files aren’t just similar, but
are1. the same exact file on
1. the same exact machine and have
1. the same exact inode values.But only `samefile` properly runs on a maximally portable POSIX-conformant
interpreter where `stat` is also installed. `samefile` works just fine in Bash
environments, too.